I read that if you do not explicitly disable AmiBroker's price bound checking, then AmiBroker will force the BuyPrice to be within the High-Low range of the entry bar.
I am testing for option volatility, so I want the sell price to be
sell = sellcondition;
SellPrice = IIF(sell and c < BuyPrice, BuyPrice + BuyPrice - C, C);
At the moment, sellprice is defaulting to just close value of the bar. How can I disable the price bound checking?
All trades should have 0% pnl but this doesnt seem to be working. I just get normal close as sellprice. But when I put some value for sellprice it works.
You alway should assign values to the price arrays when running any backtest.
Plesase refer to this part of the manual: Back testing your trading ideas
@trunda - It is simple. You assignment does nothing. Both buy price and sell price would be equal to close, but close ON DIFFERENT BARS. Close in Monday (say entry) is not the same as say on Friday (exit). So your assumption that you are going to get zero profit is just nonsensical.
To have same price assign a number, not array with different values every bar.
To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?
For what it is worth currently your understanding of backtesting is zero, and you would do yourself a favour if you did NOT disable price bound checking as it is here to protect you from shooting yourself in a foot.
Trying to use prices outside H-L range in backtest is totally unrealistic.