I am trying to code in PRT and when backtesting it is not giving the desired results, as it is NOT buying at the TargetPrice, seems I am not getting it right.
Attached screenshot for reference, where the condition met at Bar 1583 with my TargetPrice to buy at 14737.2, but it is bought at Bar 1585 at a price 14816.5.
My TargetPrice and CloseReferencePrice are also changing for each bar, and BuyBar and CurrentBar are also the same when the code runs for backtesting.
Could please advise how this should be done i.e. Buying at the TargetPrice within the next 5 bars when the C1 condition is met, with the below script:
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok