TJ wrote the following, illustrating two example cases:
If you write in your formula things like that:
BuyPrice = Ref( C, -1 );
It will assign BUYPRICE variable to be CLOSE OF YESTERDAY.
But the trade occurs TODAY (because you have set "delay of zero" as you
Now if YESTERDAY CLOSE was lower than TODAYS LOW, the backtester will
use todays LOW price (lowest possible price) because by default it
protects from using prices outside H-L range as described in the manual
The other example can be:
BuyPrice = C - ATR(1);
This will SUBTRACT true range from todays close price and use it as
buyprice, but if result is lower than todays low, the backtester will
use lowest possible price (i.e. todays low).
The above is just example of what can happen if you manipulate
BuyPrice/SellPrice/ShortPrice/CoverPrice in the formula without really
knowing what you are doing.
The key sentence from the docs page referenced above is:
During back-testing AmiBroker will check if the values you assigned to buyprice, sellprice, shortprice, coverprice fit into high-low range of given bar. If not, AmiBroker will adjust it to high price (if price array value is higher than high) or to the low price (if price array value is lower than low).
So, if you are seeing backtest trades at the high or low and you didn't put them there explicitly, then it is likely that you put them there implicitly as per above.