I am trying to get the following ProBackTest code to test ONE trade PER DAY if the price goes 20 pips above the Daily R1 Pivot Line on the 1 minute time frame however it only tests just one trade and then stops instead of continuing on subsequent days.
Can anyone advise how to limit trades to ONE PER DAY when the criteria is met.
See the code below.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 235900
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 080000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
TIMEFRAME(default)
//Pivot Points
//PrevBarLen = High[1] – Low[1]
PP = (DHIGH(1) + DLOW(1) + DCLOSE(1)) / 3 // Pivot point (PP) = (High + Low + Close) / 3
//R3 = DHIGH(1) + 2 * (PP – DLOW(1)) // Third resistance (R3) = High + 2(PP – Low)
//R2 = PP + (DHIGH(1) – DLOW(1)) // Second resistance (R2) = PP + (High – Low)
R1 = (2 * PP) – DLOW(1) // First resistance (R1) = (2 x PP) – Low
S1 = (2 * PP) – DHIGH(1) // First support (S1) = (2 x PP) – High
//S2 = PP – (DHIGH(1) – DLOW(1)) // Second support (S2) = PP – (High – Low)
//S3 = DLOW(1) – 2 * (DHIGH(1) – PP) // Third support (S3) = Low – 2(High – PP)
Once LongTradeOn = 1
If IntraDayBarIndex = 0 then
LongTradeOn = 1
Endif
If LongOnMarket or StrategyProfit <> StrategyProfit[1] Then
LongTradeOn = 0
Endif
If timeEnterBefore AND not daysForbiddenEntry AND Close < R1 + 20 AND LongTradeOn AND Not LongOnMarket THEN
Buy 1 contract at R1 + 20 STOP
EndIf
// Stops and targets
SET STOP pLOSS 20
SET TARGET pPROFIT 60
Any advice would be greatly appreciated