I’m trying to write a ProBackTest script to accurately reflect an Intraday (1 minute time frame) Strategy using End of Day Pivot Lines. However the BUY AT MARKET function enters trades at the open of the following bar. Some 1 minute bars are over 100 pips long such as the GBP/USD 13:30GMT 1 minute bar on Tuesday 13th December 2022 which went through R1 and R2. I did this trade for real and made a 60 pip profit in 20 seconds however when I try and program ProBackTest to do the same trade it waits until the next bar opens to trigger the order missing out on 78 pips and resulting in a loss. What setting or Function needs to be used so that ProBackTest can enter trades at the ACTUAL required level so it TRULY backtests strategies accurately?
Really appreciate any advice on this.
JSParticipant
Veteran
Hi @nick147
If you want the Buy to take place at a “resistance level” then you have to use (pending) Stop orders…
For example:
If Close < R1 then
Buy 1 contract at R1 STOP
EndIf
This stop order is placed every bar (minute) as long as Close < R1 and is executed when the Close passes through R1…
Hi
@JS
Thank you for your reply.
I tried your suggestion of using pending STOP orders but ProBackTest still uses the NEXT 1 minute bar which is too late.
Is there a way for ProBackTest to use the SAME bar and the ACTUAL order price of the buy order?
Some 1 minute bars are over 100 pips long such as the GBP/USD 13:30GMT 1 minute bar on Tuesday 13th December 2022 which went through R1 and R2 so when trying to buy AT R1 waiting until the next bar to open well above R2 is too late and misses the trade?
Really appreciate any advice about this.
JSParticipant
Veteran
Hi @nick147
That is very strange, can you show a piece of code including the STOP orders…?
Thank you
@JS so much
I finally got it to work.