How do I write a strategy in C# using Calculate.OnEachTick that fills an entry order at the exact tick price when price crosses an EMA, not at the next bar open?
If you followed the manual, the only thing you need to do is enable the strategy in that mode.
You could also set it programmatically.
If that still does not work, please attach your code here.
You need to download the historical tick data if you are using the strategy analyzer. You then need to understand how the historical fill process works: NinjaTrader 8
I wouldn’t rely on it anyways because it’s not accurate. In market replay, it’s also inaccurate because it plays at one second interval for the 1x speed. In that one second, your entry could be significantly away. I think if you rely on the exact price then use a limit or MIT on that price.
the important thing is both your indicator and your strategy should be running in mode Calculate.OnEachTick
If you’re trying to get accurate result in strategy analyzer, then aside from using calculate.oneachtick, you need to…
- Add a 1-tick data series to your strategy
- Do all signal generation, order submission and position management on the 1-tick data series in OnBarUpdate
