Backtesting will not begin

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #218814 quote
    pdrh
    Participant
    Average
    // Definition of code parameters
    DEFPARAM 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" time
    DEFPARAM FLATAFTER = 155800
    
    // Prevents the system from creating new orders to enter the market or increase position size before the specified time
    noEntryBeforeTime = 100000
    timeEnterBefore = time >= noEntryBeforeTime
    Daysforbidden=Call"ASX Closed Days"
    // Prevents the system from placing new orders to enter the market or increase position size after the specified time
    noEntryAfterTime = 155900
    timeEnterAfter = time < noEntryAfterTime
    ONCE Start=100000
    If Time=Start Then
    TC=0
    Endif
    
    Bank= 6000
    Capital=Bank//+Strategyprofit
    risk=1
    SHTPsize=Round((Risk/100*Capital)/sstp+.04,2)
    LNGPsize=Round((Risk/100*Capital)/lstp+.04,2)
    // Conditions to enter long positions
    ignored, indicator1 = CALL "BW FRACTALS 1Hour TF"
    c1 = (close CROSSES OVER indicator1)
    
    if c1 and TC<1  and timeEnterBefore AND  timeEnterAfter AND Not Daysforbidden THEN
    buy LNGPsize CONTRACT AT Market
    TC=TC+1
    SET STOP ploss lstp//58
    SET TARGET pPROFIT ltgt//32
    ENDIF
    
    //condition to enter short
    indicator2, ignored = CALL "BW FRACTALS 1Hour TF"
    c2 = (close CROSSES UNDER indicator2)
    If c2 AND TC<1 And  timeEnterBefore   AND timeEnterAfter And NOT Daysforbidden THEN
    Sellshort SHTPsize contract at Market
    TC=TC+1
    SET STOP ploss sstp// 54
    SET TARGET pPROFIT stgt//90
    Endif

    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

    #218823 quote
    Nicolas
    Keymaster
    Master

    I 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.

    #218870 quote
    pdrh
    Participant
    Average
    // Definition of code parameters
    DEFPARAM 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" time
    DEFPARAM FLATAFTER = 155800
    
    // Prevents the system from creating new orders to enter the market or increase position size before the specified time
    noEntryBeforeTime = 100000
    timeEnterBefore = time >= noEntryBeforeTime
    Daysforbidden=Call"ASX Closed Days"
    // Prevents the system from placing new orders to enter the market or increase position size after the specified time
    noEntryAfterTime = 155900
    timeEnterAfter = time < noEntryAfterTime
    ONCE Start=100000
    If Time=Start Then
    TC=0
    Endif
    Bank= 6000
    Capital=Bank//+Strategyprofit
    risk=1
    SHTPsize=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 positions
    c1= close crosses over FH
    if c1 and TC<1  and timeEnterBefore AND  timeEnterAfter AND Not Daysforbidden THEN
    buy LNGpsize CONTRACT AT market
    LTC=LTC+1
    SET STOP ploss lstp//58
    SET TARGET pPROFIT ltgt//32
    ENDIF
    //condition to enter short
    c2=close crosses under FL
    If c2 AND STC<1 And  timeEnterBefore   AND timeEnterAfter And NOT Daysforbidden THEN
    Sellshort SHTPsize contract at Market
    STC=STC+1
    SET STOP ploss sstp// 54
    SET TARGET pPROFIT stgt//90
    Endif
    //reverse position if stop hit
    graph FH
    graph FL

    I 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

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Backtesting will not begin


ProOrder support

New Reply
Author
author-avatar
pdrh @pdrh Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by pdrh
2 years, 5 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 08/09/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...