Wrong trading price specified by the user, was: ...not opening on open

I am backtesting a strategy and for some reason my trades are not opening at the Open Price and instead are opening at the Low price of the buy day and closing at the high price of the sell day.

I have shown my backtest screen shot here and the easiest way is to look at the last 2 symbols and you will see what I am saying.

Also here is a snippet from my code.


BuyPrice = ValueWhen(Buy, O);
SellPrice = ValueWhen(Sell, O);

Screen Shot 2022-08-01 at 6.37.52 AM

Any help would be greatly appreciated

You sent the same to the support email. Please use ONE channel not two because this consumes resources.
Your code is incorrect.

You should just write

BuyPrice = Open;
SellPrice = Open;

without using ValueWhen(). Using ValueWhen in this place is wrong.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.