The 'BackTesting2_ClosingPositions.pdf' [the link is EFS & Backtest docs on the Forum] has been very helpful. However the example code has the following logic which appears to me to be unrealistic [ie] IF THE CURRENT BAR'S HIGH IS EQUAL TO OR GREATER THAN ........ go long with a limit order ........ AT THE OPEN OF THE BAR, ......
My question is: "At the open of the bar how can we know what the bar's high is?
Please advise me as to whether this is reasonable or faulty logic.
The code block to which I am referring is:
if (high(0) >= nU) { // Long Trade Signal
/*
if the current bar's high is equal to or greater than the previous bar's
Upper Donchian channel, go long with a limit order at the value of the
previous bar's Upper Donchian value or the open of the bar, which ever is
greater.
*/
Strategy.doLong("Long Signal", Strategy.LIMIT, Strategy.THISBAR,
Strategy.DEFAULT, Math.max(nU, open(0)) );
My question is: "At the open of the bar how can we know what the bar's high is?
Please advise me as to whether this is reasonable or faulty logic.
The code block to which I am referring is:
if (high(0) >= nU) { // Long Trade Signal
/*
if the current bar's high is equal to or greater than the previous bar's
Upper Donchian channel, go long with a limit order at the value of the
previous bar's Upper Donchian value or the open of the bar, which ever is
greater.
*/
Strategy.doLong("Long Signal", Strategy.LIMIT, Strategy.THISBAR,
Strategy.DEFAULT, Math.max(nU, open(0)) );
Comment