TickReplayIndicatormyTickReplayIndicator=null; protectedoverridevoidOnStateChange() { if(State==State.SetDefaults) { Name="TestHost"; } elseif(State==State.DataLoaded) { // Store a reference to the Tick Replay indicator before State.Historical // Doing so ensures the hosted indicator will run through Tick Replay myTickReplayIndicator=TickReplayIndicator(); // For a strategy, you can just call AddChartIndicator(TickReplayIndicator()); // However this also adds a copy of the indicator to the chart, which may or may not be desired // For calculation purposes only, storing the reference should all that needs to be required. } } protectedoverridevoidOnBarUpdate() { // Access the stored reference which calculates through // historical Tick Replay data and print the value as expected Print(myTickReplayIndicator[0]); } |
1. If I understand this concept correctly, data processing in hisorical and realtime states can in some circumstances generates different outcomes because of the way the logic is processed, historic will always compute based on a full bar whereas realtime will compute based on the last bar as it is being processed. This makes sense if I understand it correctly?
2. The referenced code provides a way for Ninjatrader to process historical data on a tick by tick basis, so that it is processed in the same way as realtime data?
3. If the first 2 points are correct and I wish to implement this type of processing to historic data, how can I access the above code. When I try to implement it in an indicator, the type or namespace "TickReplayIndicator" could not be found. Is there a reference I need to specifically add to get his function to work?
Thanks
Comment