EA Head

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #41959 quote
    JohnScher
    Participant
    Veteran

    can´t believe backtest

    works only on Dax 1 Euro

    Spread 2 Euro, test from 01.01.2013

    result ~ 350%

    maybe comes little help too

    //-------------------------------------------------------------------------
    // Hauptcode : EA Head PF flat friday 210000
    //-------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    // EA Head V.1
    // EA Head H4 live PF
    // created by JohnScher with help by ProRealCode
    // Simple EMA-Strategy, timebased, mixed with some filters and a turbo by pathfinder-systems
    // Dax 1 Euro Mini, 2 Points Spread, backtested 01.01.2013 to 29.07.2017 with positiv results
    //-----------------------------------------------------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    
    
    // defparam flatafter = 210000 is possibel, if used: winnings are smaller, risks are smaller
    
    // Start Pathfinder-System
    // Pathfinder-System not coded by me, code found at ProRealCode
    // with define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
    
    
    
    
    ONCE January1 = 3 //0 risk(3)
    ONCE January2 = 0 //3 ok
    ONCE February1 = 3 //3 ok
    ONCE February2 = 3 //0 risk(3)
    ONCE March1 = 3 //0 risk(3)
    ONCE March2 = 2 //3 ok
    ONCE April1 = 3 //3 ok
    ONCE April2 = 3 //3 ok
    ONCE May1 = 1 //0 risk(1)
    ONCE May2 = 1 //0 risk(1)
    ONCE June1 = 1 //1 ok 2
    ONCE June2 = 2 //3 ok
    ONCE July1 = 3 //1 chance
    ONCE July2 = 2 //3 ok
    ONCE August1 = 2 //1 chance 1
    ONCE August2 = 3 //3 ok
    ONCE September1 = 3 //0 risk(3)
    ONCE September2 = 0 //0 ok
    ONCE October1 = 3 //0 risk(3)
    ONCE October2 = 2 //3 ok
    ONCE November1 = 1 //1 ok
    ONCE November2 = 3 //3 ok
    ONCE December1 = 3 // 1 chance
    ONCE December2 = 2 //3 ok
    
    
    // set saisonal multiplier
    currentDayOfTheMonth = Day
    midOfMonth = 15
    IF CurrentMonth = 1 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = January1
    ELSE
    saisonalPatternMultiplier = January2
    ENDIF
    ELSIF CurrentMonth = 2 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = February1
    ELSE
    saisonalPatternMultiplier = February2
    ENDIF
    ELSIF CurrentMonth = 3 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = March1
    ELSE
    saisonalPatternMultiplier = March2
    ENDIF
    ELSIF CurrentMonth = 4 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = April1
    ELSE
    saisonalPatternMultiplier = April2
    ENDIF
    ELSIF CurrentMonth = 5 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = May1
    ELSE
    saisonalPatternMultiplier = May2
    ENDIF
    ELSIF CurrentMonth = 6 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = June1
    ELSE
    saisonalPatternMultiplier = June2
    ENDIF
    ELSIF CurrentMonth = 7 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = July1
    ELSE
    saisonalPatternMultiplier = July2
    ENDIF
    ELSIF CurrentMonth = 8 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = August1
    ELSE
    saisonalPatternMultiplier = August2
    ENDIF
    ELSIF CurrentMonth = 9 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = September1
    ELSE
    saisonalPatternMultiplier = September2
    ENDIF
    ELSIF CurrentMonth = 10 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = October1
    ELSE
    saisonalPatternMultiplier = October2
    ENDIF
    ELSIF CurrentMonth = 11 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = November1
    ELSE
    saisonalPatternMultiplier = November2
    ENDIF
    ELSIF CurrentMonth = 12 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = December1
    ELSE
    saisonalPatternMultiplier = December2
    ENDIF
    Endif
    
    // in original Pathfinder-Systems was used to find out correkt positionsize see following
    // period = 14
    // atr = AverageTrueRange[period]
    // position = round(100/atr/2.1666)
    
    // here i used
    position = 1
    
    
    // End Pathfinder-System
    //-----------------------------------------------------------------------------------------------------------------------
    
    
    //-----------------------------------------------------------------------------------------------------------------------
    // Code Indicator NR7
    // just info to integrated on your workstation
    //-----------------------------------------------------------------------------------------------------------------------
    // C1= Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]
    // RETURN C1
    //-----------------------------------------------------------------------------------------------------------------------
    // End Code Indicator Nr7
    //-----------------------------------------------------------------------------------------------------------------------
    
    
    //-----------------------------------------------------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    // Start Maincode
    // Maincode : EA Head H4 Live PF
    //-----------------------------------------------------------------------------------------------------------------------
    
    
    // Filter
    // not proofed for example : williams, atr, ....
    // maybe the filters are not in the best settings, but it works in this way
    
    //-------------------------------------------------------------------------
    // Code Indicator : nr7
    //C1= Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]
    //RETURN C1
    //-------------------------------------------------------------------------
    
    cx = CALL "NR7"
    cx1 = cci[11]<80
    cx2 = cci[21]>-90
    cx3 = Momentum[6](close)>0
    cx4 = ADX[11] >15
    // cx5 = MoneyFlow[11](close)<0 (not used, maybe for optimizing
    cx6 = TR(close) >25
    cx7 = PVT(close)<1
    cx8 = EaseOfMovement[14]<95
    cx9 = SmoothedStochastic[14,3](close)<95
    cx10 = PriceOscillator[5,25](close)<0.5
    cx11 = LinearRegressionSlope[10](close)>-14
    cx12 = AccumDistr(close)>-0.1
    cx13 = Chandle [21](close)>-51
    cx14 = STD[6](close)<99
    //not used for example williams, rsi and so one to get out the tops on losses
    // end filter
    
    
    // timebase
    TradingDayShort = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    
    TradingTimeShort = time = 090000 or time = 130000 or time = 170000
    TradingtimeLong = time = 090000 or time = 130000 or time = 170000
    // end timebase
    
    
    // EMA Strategy with integrated Pathfinder-System, Filter and Timebase
    // Short-Trade
    IF  TradingDayShort and TradingTimeShort Then
    If not cx  Then
    If cx1 and cx4 and cx7 and cx8 and cx9 and cx10 and cx12 and cx14   Then
    If ExponentialAverage [1] (close) < ExponentialAverage [2] (close) Then
    sellshort position*saisonalPatternMultiplier CONTRACTS AT MARKET
    Endif
    Endif
    Endif
    ENDIF
    
    // better to set (needed) : exitshort at end of regular weekly trading-hours
    IF dayofweek = 5 and time = 210000 Then
    ExitShort at market
    ENDIF
    
    // Long-Trade
    IF  TradingDayLong and TradingTimeLong Then
    If cx2 and cx3  and cx6 and cx11  and cx13   Then
    If ExponentialAverage   [1] (close)  >  ExponentialAverage   [8] (close) THEN
    buy position*saisonalPatternMultiplier CONTRACT AT MARKET
    Endif
    Endif
    ENDIF
    
    // better to set (needed) : sell at end of regular weekly trading-hours
    IF dayofweek = 5 and time = 210000 Then
    sell at market
    ENDIF
    
    
    // can be optimezed
    // if i test only long trades i find long:  SL 0.75% and TP 1.5% more effectiv
    // in test only short trades i find Short:  SL 1.0% and TP 2.4% more effektiv
    Set Stop %Loss 1
    Set Target %Profit 2
    
    // End EMA-Strategy, End Main-Code
    //-----------------------------------------------------------------------------------------------------------------------
    //not integrated any strategyprofit-maximize-strategy like re-invest-strategies, maybe some help to integrate this ?
    //-----------------------------------------------------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    //-----------------------------------------------------------------------------------------------------------------------
    
    // kind regards JohnScher
    
    #41960 quote
    JohnScher
    Participant
    Veteran

    xcuse: timeframe 4h

    #42659 quote
    JR1976
    Participant
    Veteran

    DEar JHON

    I think is necessary to have the NR7 detail code  , isnt’it ?

    Please enclosed the backtest screenshot if you want

    Regards

    #42672 quote
    Nicolas
    Keymaster
    Master

    @JR1976

    I think you can add the NR7 code like this (replace the line 168 with this one):

    cx = Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]

    I did not test this strategy myself, but it seems over optimized, John didn’t explained us how he found all these variables values and indicators periods.

    #42758 quote
    Francesco78
    Participant
    Master

    can we see a screenshot of the statistics of the backtest?

    Thanks

    Francesco

    #42819 quote
    JohnScher
    Participant
    Veteran

    my problem is: can i believe the backtest… ?

    results are good, but too good

    code  little bit more fine

     

    see on yourself

    so my question, can you controll the result on backtest?

    timeframe 4h, start 01.01.2013 until today, Dax 1 Euro mini, spread = 2, no brokerage few

     

    do i right put the screenshots?

    can’t print the details as screenshot, find no “safe as” button ..   how it works?

     

     

     

     

    //-------------------------------------------------------------------------
    // Hauptcode : EA Head V1.2
    // created by JohnScher, coded with help from ProRealTime
    //-------------------------------------------------------------------------
    
    // Start Pathfinder-System
    // with define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
    
    defparam flatafter = 210000
    
    ONCE January1 = 3 //0 risk(3)
    ONCE January2 = 0 //3 ok
    ONCE February1 = 3 //3 ok
    ONCE February2 = 3 //0 risk(3)
    ONCE March1 = 3 //0 risk(3)
    ONCE March2 = 2 //3 ok
    ONCE April1 = 3 //3 ok
    ONCE April2 = 3 //3 ok
    ONCE May1 = 1 //0 risk(1)
    ONCE May2 = 1 //0 risk(1)
    ONCE June1 = 1 //1 ok 2
    ONCE June2 = 2 //3 ok
    ONCE July1 = 3 //1 chance
    ONCE July2 = 2 //3 ok
    ONCE August1 = 2 //1 chance 1
    ONCE August2 = 3 //3 ok
    ONCE September1 = 3 //0 risk(3)
    ONCE September2 = 0 //0 ok
    ONCE October1 = 3 //0 risk(3)
    ONCE October2 = 2 //3 ok
    ONCE November1 = 1 //1 ok
    ONCE November2 = 3 //3 ok
    ONCE December1 = 3 // 1 chance
    ONCE December2 = 2 //3 ok
    
    // set saisonal multiplier
    currentDayOfTheMonth = Day
    midOfMonth = 15
    IF CurrentMonth = 1 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = January1
    ELSE
    saisonalPatternMultiplier = January2
    ENDIF
    ELSIF CurrentMonth = 2 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = February1
    ELSE
    saisonalPatternMultiplier = February2
    ENDIF
    ELSIF CurrentMonth = 3 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = March1
    ELSE
    saisonalPatternMultiplier = March2
    ENDIF
    ELSIF CurrentMonth = 4 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = April1
    ELSE
    saisonalPatternMultiplier = April2
    ENDIF
    ELSIF CurrentMonth = 5 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = May1
    ELSE
    saisonalPatternMultiplier = May2
    ENDIF
    ELSIF CurrentMonth = 6 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = June1
    ELSE
    saisonalPatternMultiplier = June2
    ENDIF
    ELSIF CurrentMonth = 7 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = July1
    ELSE
    saisonalPatternMultiplier = July2
    ENDIF
    ELSIF CurrentMonth = 8 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = August1
    ELSE
    saisonalPatternMultiplier = August2
    ENDIF
    ELSIF CurrentMonth = 9 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = September1
    ELSE
    saisonalPatternMultiplier = September2
    ENDIF
    ELSIF CurrentMonth = 10 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = October1
    ELSE
    saisonalPatternMultiplier = October2
    ENDIF
    ELSIF CurrentMonth = 11 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = November1
    ELSE
    saisonalPatternMultiplier = November2
    ENDIF
    ELSIF CurrentMonth = 12 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = December1
    ELSE
    saisonalPatternMultiplier = December2
    ENDIF
    Endif
    
    
    position = 2
    
    // End Pathfinder-System
    //-------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------
    // Code Indicator NR7
    // C1= Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]
    // RETURN C1
    //-------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------
    // Start maincode
    //-------------------------------------------------------------------------
    // maincode : H4 Live
    //-------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    
    cx1 = cci[11]<90
    cx2 = cci[21]>-90
    cx3 = Momentum[12](close)>0
    cx4 = ADX[11] >14
    // cx5 = MoneyFlow[11](close)<0
    cx6 = TR(close) >14
    //cx7 = PVT(close)<1
    cx8 = EaseOfMovement[14]<70
    cx9 = SmoothedStochastic[21,3](close)<90
    cx10 = PriceOscillator[5,25](close)<0.5
    cx11 = LinearRegressionSlope[12](close)>-14
    cx12 = AccumDistr(close)>-0.1
    cx13 = Chandle [21](close)>-21
    cx14 = STD[6](close)<99
    cx15 = Chandle [6] (close)<49
    cx16 = RSI[6](close)<51
    cx17 = RSI[6](close)>49
    
    TradingDayShort = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3  or  dayofweek = 4 or dayofweek = 5
    
    TradingTimeShort = time = 090000 or time = 130000 or time = 170000
    TradingtimeLong = time = 090000 or Time = 130000 or time = 170000
    
    IF  TradingDayShort and TradingTimeShort Then
    IF cx1 and cx4   and cx8 and cx9 and cx10 and cx12 and cx14  and cx15 and cx16 Then
    IF ExponentialAverage [1] (close) < ExponentialAverage [8] (close) THEN
    sellshort position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF
    Endif
    Endif
     
    IF  TradingDayLong and TradingTimeLong Then
    IF cx2 and cx3  and cx6 and cx11  and cx13 and cx17 Then
    IF ExponentialAverage   [1] (close)  >  ExponentialAverage   [6] (close) THEN
    buy position*saisonalPatternMultiplier CONTRACT AT MARKET
    ENDIF
    Endif
    Endif
     
    
    Set Stop %Loss 3
    Set Target %profit 3
    
    // to be optimize
    // kind JohnScher
     
    
    EA-Head.png EA-Head.png
    #42821 quote
    JohnScher
    Participant
    Veteran

    nr7 isn´t integrated, is remnant from former code

    #42822 quote
    JohnScher
    Participant
    Veteran

    target is : find filters to get out the main losses… want anyone help?

    #42823 quote
    JohnScher
    Participant
    Veteran

    try this too as backtest

    Short Trades in a rising market

     

    //-------------------------------------------------------------------------
    // Hauptcode : H4 live cxxxx last PF flat2100
    //-------------------------------------------------------------------------
    // Start Pathfinder-System
    // with define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
    defparam flatafter = 210000
    
    ONCE January1 = 3 //0 risk(3)
    ONCE January2 = 1 //3 ok
    ONCE February1 = 3 //3 ok
    ONCE February2 = 3 //0 risk(3)
    ONCE March1 = 3 //0 risk(3)
    ONCE March2 = 2 //3 ok
    ONCE April1 = 3 //3 ok
    ONCE April2 = 3 //3 ok
    ONCE May1 = 1 //0 risk(1)
    ONCE May2 = 1 //0 risk(1)
    ONCE June1 = 1 //1 ok 2
    ONCE June2 = 2 //3 ok
    ONCE July1 = 3 //1 chance
    ONCE July2 = 2 //3 ok
    ONCE August1 = 2 //1 chance 1
    ONCE August2 = 3 //3 ok
    ONCE September1 = 3 //0 risk(3)
    ONCE September2 = 1 //0 ok
    ONCE October1 = 3 //0 risk(3)
    ONCE October2 = 2 //3 ok
    ONCE November1 = 1 //1 ok
    ONCE November2 = 3 //3 ok
    ONCE December1 = 3 // 1 chance
    ONCE December2 = 2 //3 ok
    // set saisonal multiplier
    currentDayOfTheMonth = Day
    midOfMonth = 15
    IF CurrentMonth = 1 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = January1
    ELSE
    saisonalPatternMultiplier = January2
    ENDIF
    ELSIF CurrentMonth = 2 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = February1
    ELSE
    saisonalPatternMultiplier = February2
    ENDIF
    ELSIF CurrentMonth = 3 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = March1
    ELSE
    saisonalPatternMultiplier = March2
    ENDIF
    ELSIF CurrentMonth = 4 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = April1
    ELSE
    saisonalPatternMultiplier = April2
    ENDIF
    ELSIF CurrentMonth = 5 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = May1
    ELSE
    saisonalPatternMultiplier = May2
    ENDIF
    ELSIF CurrentMonth = 6 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = June1
    ELSE
    saisonalPatternMultiplier = June2
    ENDIF
    ELSIF CurrentMonth = 7 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = July1
    ELSE
    saisonalPatternMultiplier = July2
    ENDIF
    ELSIF CurrentMonth = 8 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = August1
    ELSE
    saisonalPatternMultiplier = August2
    ENDIF
    ELSIF CurrentMonth = 9 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = September1
    ELSE
    saisonalPatternMultiplier = September2
    ENDIF
    ELSIF CurrentMonth = 10 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = October1
    ELSE
    saisonalPatternMultiplier = October2
    ENDIF
    ELSIF CurrentMonth = 11 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = November1
    ELSE
    saisonalPatternMultiplier = November2
    ENDIF
    ELSIF CurrentMonth = 12 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = December1
    ELSE
    saisonalPatternMultiplier = December2
    ENDIF
    Endif
    position = 2
    
    // End Pathfinder-System
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Start Code Indicator NR7
    //-------------------------------------------------------------------------
    // C1= Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]
    // RETURN C1
    //-------------------------------------------------------------------------
    // End Code IndicatorNr7
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Start Hauptcode
    //-------------------------------------------------------------------------
    // Hauptcode : H4 Live
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    cx1 = cci[11]<90
    //cx2 = cci[21]>-90
    //cx3 = Momentum[12](close)>0
    cx4 = ADX[11] >14
    //cx5 = MoneyFlow[14](close)>0
    //cx6 = TR(close) >14
    //cx7 = PVT(close)<1
    cx8 = EaseOfMovement[14]<70
    cx9 = SmoothedStochastic[21,3](close)<90
    cx10 = PriceOscillator[5,25](close)<0.5
    //cx11 = LinearRegressionSlope[12](close)>-14
    cx12 = AccumDistr(close)>-0.1
    //cx13 = Chandle [21](close)>-21
    cx14 = STD[6](close)<99
    cx15 = Chandle [14] (close)<49
    cx16 = RSI[6](close)<51
    //cx17 = RSI[6](close)>49
    cx18 = Chandle[12](close)>-21
    cx19 = Williams[14](close)<-29
    cx20 = Repulse[6](close)<-0.22
    cx21 = MassIndex[12]>10
    
    
    TradingDayShort = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    //TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3  or  dayofweek = 4 or dayofweek = 5
    TradingTimeShort = time = 090000 or time = 130000 or time = 170000
    //TradingtimeLong = time = 090000 or Time = 130000 or time = 170000
    
    IF  TradingDayShort and TradingTimeShort Then
    IF cx1 and cx4   and cx8 and cx9 and cx10 and cx12 and cx14  and cx15 and cx16 and cx18 and cx19 and cx20 and cx21 Then
    IF ExponentialAverage [1] (close) < ExponentialAverage [4] (close) THEN
    sellshort position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF
    Endif
    Endif
    
    IF ShortonMarket Then
    Set Stop %Loss 3
    Set Target %Profit 3
    Endif
     
    //IF  TradingDayLong and TradingTimeLong Then
    //IF cx2 and cx3 and cx5 and cx6 and cx11  and cx13 and cx15 and cx17  Then
    //IF ExponentialAverage   [1] (close)  >  ExponentialAverage   [8] (close) THEN
    //buy position*saisonalPatternMultiplier CONTRACT AT MARKET
    //ENDIF
    //Endif
    //Endif
     
    //IF Longonmarket then
    //Set Stop %Loss 1
    //Set Target %profit 1
    //Endif
    
     
     
    
    #42845 quote
    Nicolas
    Keymaster
    Master

    Thank you John, I received also your post in the library pending review list. I may be wrong, but I think you have optimized many variables (indicators’periods and levels), am I right? In this case, did you test also the best values in OOS (Out Of Sample) periods? Now that is available, you can use Walk Forward optimiser which help you find the good edge between over optimized strategy and robust one.

    The fact is that the result of your backtest is, as you stated, “unbelievable”, because it is like you use the best suitable values for things you know already how they will happen.

    #42848 quote
    JohnScher
    Participant
    Veteran

    Hello Nicolas.

     

    So the Backtest give not a right result?

    What ist OOS?

    How does works walk forward? Do you have any Link  or can you test the EA HEad only Short with walk forward?

    EA-Head-nur-Short.png EA-Head-nur-Short.png
    #42907 quote
    Nicolas
    Keymaster
    Master

    The strategy seems quite overfitted on past price behaviour. I encourage you reading these articles:

    In this first one, you’ll learn about In Sample and Out Of Sample testing methodology:

    https://www.prorealcode.com/blog/avoid-equity-curve-fitting-with-probacktest-trading-strategy-optimisation/

    This one is the extract of the proorder documentation about the new tool (walk forward analysis): 

    https://www.prorealcode.com/blog/learning/strategy-optimisation-walk-analysis/

    Another post I made, as a FAQ for the Walk Forward tool (made of pieces from different discussions here and there on forums):

    https://www.prorealcode.com/blog/learning/prorealtime-walk-analysis-tool/

    #43013 quote
    JohnScher
    Participant
    Veteran

    Hello Nikolas.

     

    Thanks so lot.

    I have integrate EA Head and “Short on rising markets” in Demo-Account on PRT.

    I ll give response, after 10 Trades run out. I ll give response about the match of the backtest results with the demo results too.

    Dito EA Head.

    So far so good.

     

    best regards

    #44147 quote
    JohnScher
    Participant
    Veteran

    First Trade: “Short on rising market”

    at Demo-Account

     

    Open 17:00:06 today at 12.202,08 6 CFD closed 21:00:04 at 12.158,1

    Result +268.20

    #44152 quote
    JohnScher
    Participant
    Veteran

    the code i use

    copy paste

    //-------------------------------------------------------------------------
    // Hauptcode : Short in a rising market
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Hauptcode : H4 live cxxxx last PF flat2100
    //-------------------------------------------------------------------------
    // Start Pathfinder-System
    // with define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
    defparam flatafter = 210000
    
    ONCE January1 = 3 //0 risk(3)
    ONCE January2 = 1 //3 ok
    ONCE February1 = 3 //3 ok
    ONCE February2 = 3 //0 risk(3)
    ONCE March1 = 3 //0 risk(3)
    ONCE March2 = 2 //3 ok
    ONCE April1 = 3 //3 ok
    ONCE April2 = 3 //3 ok
    ONCE May1 = 1 //0 risk(1)
    ONCE May2 = 1 //0 risk(1)
    ONCE June1 = 1 //1 ok 2
    ONCE June2 = 2 //3 ok
    ONCE July1 = 3 //1 chance
    ONCE July2 = 2 //3 ok
    ONCE August1 = 2 //1 chance 1
    ONCE August2 = 3 //3 ok
    ONCE September1 = 3 //0 risk(3)
    ONCE September2 = 1 //0 ok
    ONCE October1 = 3 //0 risk(3)
    ONCE October2 = 2 //3 ok
    ONCE November1 = 1 //1 ok
    ONCE November2 = 3 //3 ok
    ONCE December1 = 3 // 1 chance
    ONCE December2 = 2 //3 ok
    // set saisonal multiplier
    currentDayOfTheMonth = Day
    midOfMonth = 15
    IF CurrentMonth = 1 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = January1
    ELSE
    saisonalPatternMultiplier = January2
    ENDIF
    ELSIF CurrentMonth = 2 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = February1
    ELSE
    saisonalPatternMultiplier = February2
    ENDIF
    ELSIF CurrentMonth = 3 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = March1
    ELSE
    saisonalPatternMultiplier = March2
    ENDIF
    ELSIF CurrentMonth = 4 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = April1
    ELSE
    saisonalPatternMultiplier = April2
    ENDIF
    ELSIF CurrentMonth = 5 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = May1
    ELSE
    saisonalPatternMultiplier = May2
    ENDIF
    ELSIF CurrentMonth = 6 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = June1
    ELSE
    saisonalPatternMultiplier = June2
    ENDIF
    ELSIF CurrentMonth = 7 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = July1
    ELSE
    saisonalPatternMultiplier = July2
    ENDIF
    ELSIF CurrentMonth = 8 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = August1
    ELSE
    saisonalPatternMultiplier = August2
    ENDIF
    ELSIF CurrentMonth = 9 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = September1
    ELSE
    saisonalPatternMultiplier = September2
    ENDIF
    ELSIF CurrentMonth = 10 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = October1
    ELSE
    saisonalPatternMultiplier = October2
    ENDIF
    ELSIF CurrentMonth = 11 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = November1
    ELSE
    saisonalPatternMultiplier = November2
    ENDIF
    ELSIF CurrentMonth = 12 THEN
    IF currentDayOfTheMonth <= midOfMonth THEN
    saisonalPatternMultiplier = December1
    ELSE
    saisonalPatternMultiplier = December2
    ENDIF
    Endif
    position = 2
    
    // End Pathfinder-System
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Start Code Indicator NR7
    //-------------------------------------------------------------------------
    // C1= Range<Range[1] and Range<Range[2] and Range<Range[3] and Range<Range[4] and Range<Range[5] and Range<Range[6] and Range<Range[7]
    // RETURN C1
    //-------------------------------------------------------------------------
    // End Code IndicatorNr7
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Start Hauptcode
    //-------------------------------------------------------------------------
    // Hauptcode : H4 Live
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    cx1 = cci[11]<90
    //cx2 = cci[21]>-90
    //cx3 = Momentum[12](close)>0
    cx4 = ADX[11] >14
    //cx5 = MoneyFlow[14](close)>0
    //cx6 = TR(close) >14
    //cx7 = PVT(close)<1
    cx8 = EaseOfMovement[14]<70
    cx9 = SmoothedStochastic[21,3](close)<90
    cx10 = PriceOscillator[5,25](close)<0.5
    //cx11 = LinearRegressionSlope[12](close)>-14
    cx12 = AccumDistr(close)>-0.1
    //cx13 = Chandle [21](close)>-21
    cx14 = STD[6](close)<99
    cx15 = Chandle [14] (close)<49
    cx16 = RSI[6](close)<51
    //cx17 = RSI[6](close)>49
    cx18 = Chandle[12](close)>-21
    cx19 = Williams[14](close)<-29
    cx20 = Repulse[6](close)<-0.22
    cx21 = MassIndex[12]>10
    
    
    TradingDayShort = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    //TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3  or  dayofweek = 4 or dayofweek = 5
    TradingTimeShort = time = 090000 or time = 130000 or time = 170000
    //TradingtimeLong = time = 090000 or Time = 130000 or time = 170000
    
    IF  TradingDayShort and TradingTimeShort Then
    IF cx1 and cx4   and cx8 and cx9 and cx10 and cx12 and cx14  and cx15 and cx16 and cx18 and cx19 and cx20 and cx21 Then
    IF ExponentialAverage [1] (close) < ExponentialAverage [4] (close) THEN
    sellshort position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF
    Endif
    Endif
    
    IF ShortonMarket Then
    Set Stop %Loss 3
    Set Target %Profit 3
    Endif
     
    //IF  TradingDayLong and TradingTimeLong Then
    //IF cx2 and cx3 and cx5 and cx6 and cx11  and cx13 and cx15 and cx17  Then
    //IF ExponentialAverage   [1] (close)  >  ExponentialAverage   [8] (close) THEN
    //buy position*saisonalPatternMultiplier CONTRACT AT MARKET
    //ENDIF
    //Endif
    //Endif
     
    //IF Longonmarket then
    //Set Stop %Loss 1
    //Set Target %profit 1
    //Endif
    
     
     
    
    Nicolas thanked this post
Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.

EA Head


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JohnScher @johnscher Participant
Summary

This topic contains 15 replies,
has 4 voices, and was last updated by JohnScher
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/29/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...