1H EURUSD with good walk forward robustness tests

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #106188 quote
    Stefanb
    Participant
    Senior

    This is not my code but I have modified it a bit.

    Optimized it with a regular back test. (100%)

    Then I did a WF with 5 periods with 70% IS.

    The result looks pretty good according to what I learned the last few days about WF.

    DEFPARAM CumulateOrders =  FALSE// Posizioni cumulate disattivate
    
    ONCE trailingStopType          = 1    // 0 NONE, 1 TRAILING
    ONCE percprofit                = 0.5     // 0.5
    ONCE percloss                  = 1     // 1
    ONCE barlong                   = 15    //15
    ONCE barshort                  = 15    //15
    ONCE atrtrailingperiod         = 200  //200
    ONCE minstop                   = 5 //5  Pipsize - least distance of the stop for IG
    ONCE trailingstoplong          = 15    //15 Trailing stop start and distance
    ONCE trailingstopshort         = 15    // 15
    // FRACTAL
    ONCE CP                        = 120    // 120
    // MOVING AVERAGE
    ONCE avgLongPeriod             = 80   // 80
    // CUMMRSI
    ONCE CumRsiPer                 = 2    // 2
    ONCE cumrsiEnterLongThreshold  = 160   // 160
    ONCE cumrsiEnterShortThreshold = 60   // 60
    
    // TRAILINGSTOP
    //----------------------------------------------
    atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pointsize)
    //atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pointsize)/1000  // for indices divided for 1000
    trailingstartl = round(atrtrail*trailingstoplong)    //trailing stop start and distance
    trailingstartS = round(atrtrail*trailingstopshort)
    
    if trailingStopType = 1 THEN
    TGL =trailingstartl
    TGS=trailingstarts
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    PREZZOUSCITA = 0
    ENDIF
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL*pointsize then
    if MAXPRICE-tradeprice(1)>=MINSTOP then
    PREZZOUSCITA = MAXPRICE-TGL*pointsize
    ELSE
    PREZZOUSCITA = MAXPRICE - MINSTOP*pointsize
    ENDIF
    ENDIF
    ENDIF
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close)
    if tradeprice(1)-MINPRICE>=TGS*pointsize then
    if tradeprice(1)-MINPRICE>=MINSTOP then
    PREZZOUSCITA = MINPRICE+TGS*pointsize
    ELSE
    PREZZOUSCITA = MINPRICE + MINSTOP*pointsize
    ENDIF
    ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
    EXITSHORT AT PREZZOUSCITA STOP
    SELL AT PREZZOUSCITA STOP
    ENDIF
    ENDIF
    
    
    // FILTER SETTING
    
    ///BILL WILLIAM FRACTAL INDICATOR
    //CP=PERIOD
    if Close[cp] >= highest[2*cp+1](Close) then
    LH = 1
    else
    LH = 0
    endif
    if Close[cp] <= lowest[2*cp+1](Close)  then
    LL = -1
    else
    LL = 0
    endif
    if LH = 1 then
    HIL = Close[cp]
    endif
    if LL = -1 then
    LOL = Close[cp]
    endif
    
    PTN01 = (close CROSSES OVER HIL)
    PTN02 = (close CROSSES UNDER LOL)
    
    // CUMRSI
    CUMRSI = SUMMATION[CUMRSIPER](RSI[CUMRSIPER](close))
    // ENTRY
    cumrsiFilterEnterLong  = (cumrsi > cumrsiEnterLongThreshold)
    cumrsiFilterEnterShort = (cumrsi < cumrsiEnterShortThreshold)
    
    //MOVING AVERAGE
    longAvg  = Average[avgLongPeriod] (close)
    
    //Enter
    avgFilterEnterLong  = (close>longAvg)
    avgFilterEnterShort = (close<longAvg)
    
    //--------------------------------------------------------------------------------------------------
    
    // STRATEGY
    //--------------------------------------------------------------------------------------------------
    if (time >=100000 and time < 230000) then
    IF NOT LongOnMarket AND avgFilterEnterLong AND PTN01  AND cumrsiFilterEnterLong THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF NOT ShortOnMarket AND avgFilterEnterShort AND PTN02 AND cumrsiFilterEnterShort THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    ENDIF
    
    // Condizioni per uscire da posizioni long
    IF POSITIONPERF<0 THEN
    IF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barLong THEN
    SELL AT MARKET
    ENDIF
    ENDIF
    IF POSITIONPERF<0 THEN
    IF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort  THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF
    
    SET STOP %LOSS percloss
    SET TARGET %PROFIT percprofit
    graph tgl
    graph tgs
    
    GraHal and kj1988 thanked this post
    eurusd.jpg eurusd.jpg
    #106203 quote
    GraHal
    Participant
    Master

    Strange I get better looking equity curve on DAX and DJI than I do on EURUSD over 100k bars, Spread = 2 in all images attached.

    My results auger well for the strategy being robust (good on 2 Markets, maybe more? )

    Why are my results on eurusd not good over 100k bars (3rd image attached). If I look at half of your equity curve over 200k bars on eurusd then yours increases steadily, mine does not!

    Ill go check timezones in the code and amend to match yours in Sweden.

    Thanks anyway for sharing.

    I have set it going on Demo DAX 1H for now.

    Stefb.jpg Stefb.jpg Stefb-2.jpg Stefb-2.jpg Stefb-3.jpg Stefb-3.jpg
    #106208 quote
    GraHal
    Participant
    Master

    Ill go check timezones

    Yeah that was it … Times at Line 104 … knocked 1 hour off (to get same as Sweden) better equity curves on all 3 Markets now!

    Nice one Stefan! 🙂

    Stefanb thanked this post
    Stefb-4.jpg Stefb-4.jpg
    #106210 quote
    Stefanb
    Participant
    Senior

    This is my time settings.

    Must test DAX and DJ.

    I use spread 1 on EURUSD.

    GraHal thanked this post
    time.jpg time.jpg
    #106212 quote
    GraHal
    Participant
    Master

    knocked 1 hour off (to get same as Sweden)

    I meant I set your 100000 (Sweden UTC +2) to 090000 (UTC+1 in UK)

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

1H EURUSD with good walk forward robustness tests


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Stefanb @stefanb Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by GraHal
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/02/2019
Status: Active
Attachments: 6 files
Logo Logo
Loading...