Greetings:
I'm running a formula in a one-minute ES advanced chart and wish to retrieve the close of the prior three price bars for the DAX (for which I'm receiving the data feed), and load them into an array. The formula is using setComputeOnClose(). To do this I'm using the following:
if (getBarState() == BARSTATE_NEWBAR)
{
LastDAXclose = close(-1, sym("$DAX-XET"));
DAXcloseArray[0] = DAXcloseArray[1];
DAXcloseArray[1] = DAXcloseArray[2];
DAXcloseArray[2] = LastDAXclose;
}
debugClear();
debugPrintln(" LastDAXclose: " + LastDAXclose);
debugPrintln(" DAXcloseArray[0]: " + DAXcloseArray[0]);
debugPrintln(" DAXcloseArray[1]: " + DAXcloseArray[1]);
debugPrintln(" DAXcloseArray[2]: " + DAXcloseArray[2]);
The Formula Output Window is returning:
DAXcloseArray [2]: 7421.81
DAXcloseArray [1]: 7421.81
DAXcloseArray [0]: 7421.81
LastDAXclose: 7421.81
Unfortunately, the values for the close of the last three price bars on my one-minute DAX chart are:
Bar (-1): 7423.51
Bar (-2): 7422.19
Bar (-3): 7423.59
My research to resolve the issue has failed miserably. Can anyone see my error? I can of course set the closing prices I need as Global variables in the DAX chart and pull them into the ES chart, but then I lose my backtesting capabilities.
Thanks,
Warren
I'm running a formula in a one-minute ES advanced chart and wish to retrieve the close of the prior three price bars for the DAX (for which I'm receiving the data feed), and load them into an array. The formula is using setComputeOnClose(). To do this I'm using the following:
if (getBarState() == BARSTATE_NEWBAR)
{
LastDAXclose = close(-1, sym("$DAX-XET"));
DAXcloseArray[0] = DAXcloseArray[1];
DAXcloseArray[1] = DAXcloseArray[2];
DAXcloseArray[2] = LastDAXclose;
}
debugClear();
debugPrintln(" LastDAXclose: " + LastDAXclose);
debugPrintln(" DAXcloseArray[0]: " + DAXcloseArray[0]);
debugPrintln(" DAXcloseArray[1]: " + DAXcloseArray[1]);
debugPrintln(" DAXcloseArray[2]: " + DAXcloseArray[2]);
The Formula Output Window is returning:
DAXcloseArray [2]: 7421.81
DAXcloseArray [1]: 7421.81
DAXcloseArray [0]: 7421.81
LastDAXclose: 7421.81
Unfortunately, the values for the close of the last three price bars on my one-minute DAX chart are:
Bar (-1): 7423.51
Bar (-2): 7422.19
Bar (-3): 7423.59
My research to resolve the issue has failed miserably. Can anyone see my error? I can of course set the closing prices I need as Global variables in the DAX chart and pull them into the ES chart, but then I lose my backtesting capabilities.
Thanks,
Warren
Comment