A practical problem: Stop the Strategy if daily PnL has reached a limit
As I wrote at the beginning, yes, NT8 has a way to do this procedure, however, it uses OnBarUpdate() for it, so what I want is an independent event-driven method that detects and stop the Strategy at any moment. So, in order to use OnAccountItemUpdate() as it's shown bellow, I'd need to know:
protected override void OnAccountItemUpdate(Account account, AccountItem accountItem, double value) { if ( Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar)+Account.Get(AccountItem.UnrealizedProfitLoss, Currency.UsDollar) <= -Maxlos ) { // do code } }
2. Do I need to subscribe to something in order to use this method ?
3. In the sample above:
a. Would that snnipet work reliably?
b.is there a more efficient way ?
A last important question: using this even-driven method to check account variables, does it use less pc resources than checking PnL variable checking within ObBarUpdate() ?
I'd highly appreciate any other ideas and suggestions that may help me to figure this out.
Thanks in advance
Comment