In this thread I'm going to try to achieve something I find useful, and that currently Ninjatrader does not support: having Indicators calculated on real time (COBC false) on a CalculateOnBarClose strategy. NT support says it's not possible, but maybe we, together can achieve it.
My first thoughts:
1) We could achieve this by having a CalculateOnBarClose false strategy. All indicators would be then calculated on realtime, and we could handle COBC entry points by using FirstTickOfBar. Unfortunately backtesting a CalculateOnBarClose false strategy it's not very reliable.
2) We could achieve this by attaching a 1tick chart to the strategy, and discriminating on BarUpdate from the main chart (i.e. 1 minute) and the tick chart using BarsInProgress. So we basically could code two functions to be called in each case i.e OnBarTickUpdate() and OnBarCloseUpdate(). We could now place our code in either function depending on the granularity needed or wanted (i.e entries and trail stops on OnBarCloseUpdate and exits on OnBarTickUpdate). The only issue left is that if we want the main 1 min indicators to be updated with every OnBarTickUpdate() we need to hack something to make it work.
So, I think the way to go is the 2 option. But we need to be able to emulate the COBC false update of the indicators.
What we need is to calculate our own OHLC values for the current bar using tick data, and update the current bar of 1min indicators with them.
We could try this by:
A) Custom coding every single indicator we use in our estrategy, and replacing their use of High, Low, Close with our own code.
B) Adding code to the indicator class to handle this through all indicators.
At the moment I'm trying option B, I've tryed to overload the High, Low, Close Dataseries without success but I'll keep looking for a way to achieve this.
I just wanted to open this thread to hear other thoughts or ideas, and to post my advancement.
Thanks Fat Tails, but the problem I have is that my exit conditions are based in the indicators running on the 1 minute bars, and I can't find a proper translation between those and the ones running in the 1 tick or even 1 second bars.
i.e. If I want to exit when DM.DIMinus>XXX on the 1 minute bars, How can I find the equivalent to that in the 1 tick o 1 second bars?
You need to code it. You can take the last known value of DM.DiMinus which was calculated from 1 min bars. Then you apply the DM indicator formulae to both the prior values of DM stored by the indicator and the last price retrieved by the 1-tick bar series.
The result is the current intrabar value of the indicator. That is all you need to do.
That was my original idea, but then I got greedy and I though we could be able to somehow overload the high, low, close for the current bar and modify the Indicator class to have that functionality in every indicator...