I am confused about when exactly a trade occurs given the trade delay given the following
piece of code below.
I have two questions that are given below.
NOTE: I am using Intraday 1-minute data.
SetTradeDelays( 0, 0, 0, 0 );
Buy = ConnorsRSI(paramLenRSI,paramLenUD,paramLenRank) < 30
AND Close > MA(Ref(Close, -1), 200)
AND ClosingRange() <= 15
AND MA(V, 21) >= 1000000
AND ADX(10) > 30
AND C >= 10.0;
By the definition in the manual, it says "Trade Current Bar on CLOSE...".
Q1) So, to be clear, does this mean, given 1 minute intraday data that at the END of a given 1-minute interval,
it would Buy on the Close ? Is this correct?
Q2) In addition, does this also mean, in the Backtest report when AmiBroker says it bought a stock at 9:30 am,
that in reality, what is happening is that at the END of the 1-min interval (e.g, 093059), it buys the stock. So, it actually waits about 1 minute to buy the stock? (I.e., it really bought the stock around 9:30:59 am) is this a correct assumption?
The backtester uses periodicity set in the settings. So if you use 1-minute periodicity, as mentioned above, the granularity (resolution) is 1-minute and the system does not use anything beyond that. So backtester will just use the close of 1-minute candle as reported by data source. If you care about exact seconds, you need to backtest using 1-second interval.
For all practical purposes, if you use signals generated using close of current candle, it is advised to use trading on next bar open, or if you for some reason use no delay, account for (large) slippage as in practice you won't know bar close until the bar is already complete and you can't trade on that exact close, so you have to calculate your indicators prematurely (before real close to place the order that has chances to be filled)