Backtesting will not begin
Forums › ProRealTime English forum › ProOrder support › Backtesting will not begin
- This topic has 2 replies, 2 voices, and was last updated 1 year ago by pdrh.
-
-
08/09/2023 at 11:59 AM #218814123456789101112131415161718192021222324252627282930313233343536373839404142434445// Definition of code parametersDEFPARAM CumulateOrders = false// Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 100000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 155800// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 100000timeEnterBefore = time >= noEntryBeforeTimeDaysforbidden=Call"ASX Closed Days"// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 155900timeEnterAfter = time < noEntryAfterTimeONCE Start=100000If Time=Start ThenTC=0EndifBank= 6000Capital=Bank//+Strategyprofitrisk=1SHTPsize=Round((Risk/100*Capital)/sstp+.04,2)LNGPsize=Round((Risk/100*Capital)/lstp+.04,2)// Conditions to enter long positionsignored, indicator1 = CALL "BW FRACTALS 1Hour TF"c1 = (close CROSSES OVER indicator1)if c1 and TC<1 and timeEnterBefore AND timeEnterAfter AND Not Daysforbidden THENbuy LNGPsize CONTRACT AT MarketTC=TC+1SET STOP ploss lstp//58SET TARGET pPROFIT ltgt//32ENDIF//condition to enter shortindicator2, ignored = CALL "BW FRACTALS 1Hour TF"c2 = (close CROSSES UNDER indicator2)If c2 AND TC<1 And timeEnterBefore AND timeEnterAfter And NOT Daysforbidden THENSellshort SHTPsize contract at MarketTC=TC+1SET STOP ploss sstp// 54SET TARGET pPROFIT stgt//90Endif
I have a strategy that I want to test but the backtest will not start .
I get the error message “Backtesting can’t start because of a parsing error in the code : Line 1,column 0”
I want to run the strategy on the 2 Min chart and place a buy order when the close is greater than the high fractal on the 1 hour chart
08/09/2023 at 12:20 PM #218823I think the reason is that you are using a CALL indicator that use TIMEFRAME instruction.
If you want to use values from another timeframe in a strategy, locate that calculation (made directly in the strategy or in a CALL indicator) in the strategy itself and by using the TIMEFRAME instuction there.
08/09/2023 at 11:03 PM #2188701234567891011121314151617181920212223242526272829303132333435363738394041424344454647// Definition of code parametersDEFPARAM CumulateOrders = false// Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 100000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 155800// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 100000timeEnterBefore = time >= noEntryBeforeTimeDaysforbidden=Call"ASX Closed Days"// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 155900timeEnterAfter = time < noEntryAfterTimeONCE Start=100000If Time=Start ThenTC=0EndifBank= 6000Capital=Bank//+Strategyprofitrisk=1SHTPsize=Round((Risk/100*Capital)/sstp+.04,2)LNGPsize=Round((Risk/100*Capital)/lstp+.04,2)Timeframe(1hour,UPDATEONCLOSE)FL,ignored=call"Harko_fractals BW"(1)ignored,FH=call"Harko_fractals BW"(1)Timeframe (Default)// Conditions to enter long positionsc1= close crosses over FHif c1 and TC<1 and timeEnterBefore AND timeEnterAfter AND Not Daysforbidden THENbuy LNGpsize CONTRACT AT marketLTC=LTC+1SET STOP ploss lstp//58SET TARGET pPROFIT ltgt//32ENDIF//condition to enter shortc2=close crosses under FLIf c2 AND STC<1 And timeEnterBefore AND timeEnterAfter And NOT Daysforbidden THENSellshort SHTPsize contract at MarketSTC=STC+1SET STOP ploss sstp// 54SET TARGET pPROFIT stgt//90Endif//reverse position if stop hitgraph FHgraph FLI have also tried that Nicholas and the backtest runs but no orders are placed
I graphed FH and FL and they are returned as zero on the backtest variables yet when I added an indicator to the 2 minute chart to display the difference between the High 1 hour chart fractal and ther
close on the 2 minute chart it looks as would expect -
AuthorPosts
Find exclusive trading pro-tools on