DAS Script Per-Symbol State and Account Context
Separate read-only quote fields from custom data and account-specific state.
Three owners, three lifecycles
Prerequisite: custom objects and quote access. Market fields such as BID and ASK report external observations. QuoteObj.data is a documented slot for your own data and is writable. Account state belongs to an explicitly selected account. A symbol-keyed quote object does not automatically create separate data for two accounts trading that symbol.
Attach one owned record
Advanced Script · reads quotes and replaces this quote object’s custom data. Use a dedicated practice session with MSFT quotes loaded and no other script owning its data slot. Do not run this initialization repeatedly from a timer.
Working example
$feQuote = GetQuoteObj("MSFT");
$feQuote.data = NewUserObj();
$feQuote.data.owner = "FE_QuotePractice";
$feQuote.data.schema = 1;
$feQuote.data.enabled = 0;
$feQuote.data.sampleSecond = GetSecond();
$feQuote.data.observedBid = $feQuote.BID;
$feQuote.data.observedAsk = $feQuote.ASK;
MsgBox($feQuote.data.owner, $feQuote.data.observedBid);
What is live and what is a snapshot?
The quote object can expose changing quotes; observedBid is a copied value from one execution. sampleSecond records script observation time, not exchange time. Reassigning data discards the previous slot value from this quote’s perspective. If multiple modules need custom symbol state, establish one parent object and allocate named child records, or maintain a separate application-owned registry. Never interpret a custom armed flag as a broker state.
Account inspection
GetAccountObj("account") exposes BP, NBP and Equity in the reviewed guide. Use the exact configured training account and inspect it before assigning meanings to the values. A minimal read is shown below; TR_PRACTICE is a placeholder, not a provisioned account. BP, NBP and Equity are not interchangeable, and this course does not infer a universal NBP formula from its abbreviation.
Account-read fragment
// Replace TR_PRACTICE with a verified training account first.
$feAccount = GetAccountObj("TR_PRACTICE");
$feAccount.ShowObject();
MsgBox($feAccount.BP, $feAccount.Equity);
Exercise and worked answer
Two accounts observe MSFT and both write quote.data.ready. Why is that insufficient? Answer: the key identifies the symbol, not account plus symbol. Store the account identity inside the record and reject mismatches, or use separate account-owned registries. Also invalidate prepared state when the selected account changes. A good test changes account without changing symbol.