NinjaCoding @ NinjaTrader
Open in Telegram
546
Subscribers
+324 hours
+147 days
+3230 days
Posts Archive
I just lost 10 subscribers when I started talking about code!!))) Maybe I should talk more about black boxes that can make XXX and activate those fake prop trading accounts where traders are promised to get funded if they pay 500USD to pass a test they can never pass)
So overall if your strategy is of stop and reverse type which means your enter long signal is also your exit short signal and you want to reverse your trades at this point and you also want to monitor full trade performance you have to CLOSE the trade inside OnBarUpdate method but then wait untill OnExecutionUpdate is hit with that order executed and then do the thing with looking into the performance and deciding whether you are ok to reverse or not based on your performance values.
That kind of makes sense because at that point you don't know the fill price for your exit yet so the trade should be added after OnExecutionUpdate has passed!
Be aware of one little catch though. If you try and calculate the profit inside the bar update method it will not return a correct value. It seems Ninja adds the trade to SystmPerformance collection only after OnBarUpdate is finished. So for example, if you close a trade and then want to open a new trade right on but before doing that you want to have a look at total performance in the system performance the trade that just closed won't be there.
4 more people to get this group to 300 subscribers!!! I will give 1 day 30% discount to everyone here when that happens!))
Sometimes you would have an order say 6 lots. You get filled with 5 and then with 1 more. This means OnExecutionUpdate will fire up twice. Now, what is important though, we would expect it to give an order state change from partly filled on first execution to filled on second execution however that is NOT always the case. In order to fix this problem you can use this work around and proceed to rest of your order management logic upon getting fully filled.
Shall I make OrderFlow Cumulative Delta indicator source code?
