Using an SMA(10) of the closing price in a chart set to COBC = false as an example, the values on the previous 9 bars will be fixed (i.e., Close[9], Close[8], Close[7], ..., Close[1]) and Close[0] will vary based upon the intrabar movements before the final movement and the bar closes and moves to the next bar--at which point everything just moves forward one position and the calculations start all over again.
My question is whether or not it would be possible to pass an indicator a fixed value to complete the calculation. For instance, on the SMA(10), I would pass the previous 9 closing prices because they are done and locked, but the current bar has a high and low between 100.00 and 90.00. Would it be possible for me to somehow pass 92.50 or 94.75 or 98.25 or whatever value I wanted to as a substitute value for use in the calculation of the SMA(10)?
I have done this in the past by just writing a small routine that actually calculates the entire SMA or EMA or whatever out for backtesting purposes, but before I start doing that for other more in depth indicators I figured that I should see if NT7 has a way for me to pass a different "Close[0]" to the indicator while still having the indicator use the locked in historical prices for the balance of the indicator calculations.
I'm interested in this because let's say that I am using a 60 minute bar primary series and I want to backtest a strategy that attempts to replicate the results as if COBC was set to false (i.e., intrabar orders could be fired). If you were to just run the backtest on the 60 minute bar series, clearly an order would have fired on the signal bar--but the NT back test engine would have to wait to put you into the trade until the open of the next bar, which is not how things would have gone down during a live/SIM trade. Therefore, I'm interested in the idea of running a for loop using the High[0] and Low[0] as upper and lower bounds to pass values to the indicators in question to see when the indicator value and order would have fired (for instance, when did a fast SMA cross a slow SMA). Furthermore, because a couple of prices could have made the indicator fire, I would also have some code that would assume a conservative entry price for longs (i.e., start from the High and work to the low, and take the first price to calculate that would have triggered a live/SIM order) and shorts (i.e., start from the Low and work to the High, and take the first price that would have triggered a live/SIM order).
I know the above sounds complicated, but I'm trying to use a belts and suspenders back testing approach that will allow me be more confident in my back test results, as using a 1 minute secondary series to determine the "live/SIM" order prices does not provide the confidence that I am seeking (i.e., highly volatile instruments like CL can move 10 ticks in a minute, thereby yielding a crummy backtest simulation).
Please let me know if you have any questions or you need clarifications.
Thanks for your help,
Aventeren
Comment