1 Min Trading Strategy

Viewing 15 posts - 151 through 165 (of 220 total)
  • Author
    Posts
  • #47991 quote
    unkown0403
    Member
    New

    Sorry guys,

    I know we have already talked about the prblem of the divided by zero!ùI have read what you have suggest to solve this problem,

    but I still got the same issue. I can0t solve it by myself.

    The system stops everyday

    Can anyone help me please?

    I post the strategy I use

    THANKS TO juanj

     

     

    DEFPARAM CumulateOrders = False // Cumul des positions désactivé

    noEntryBeforeTime = 090000
    timeEnterBefore = time >= noEntryBeforeTime

    noEntryAfterTime = 173000
    timeEnterAfter = time < noEntryAfterTime

    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    If longonmarket and close < positionprice and (barindex-tradeindex) > 650 Then
    Sell at market
    ElsIf shortonmarket and close > positionprice and (barindex-tradeindex) > 60 then
    Exitshort at market
    EndIf

    body=close-open

    abody=abs(body)

    if range>0.1 then
    ratio=abody/range
    else
    ratio=0
    endif

    middle=(open+close)/2

    bodytop=max(open, close)

    bodybottom=min(open, close)

    shadowtop=high-bodytop

    shadowbottom=bodybottom-low

    longcandle= (ratio>0.6)

    Bull = 0
    Bear = 0

    //Bullish Signals

    MorningStar=(body[2]<0 and body>0 and longcandle[2] and open[1]<close[2] and open>close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and low[1]<low and low[1]<low[2] and high[1]<open[2] and high[1]<close)
    if MorningStar then
    Bull = 1 //Positive
    endif

    PiercingLine=(body[1]<0 and body>0 and longcandle[1] and longcandle and open<low[1] and close>middle[1] and close<open[1])
    if PiercingLine then
    Bull = 1 //None
    endif

    AbandonedBabyBottom=(body[2]<0 and body>0 and longcandle[2] and ratio[1]<0.3 and high[1]<low[2] and high[1]<low)
    if AbandonedBabyBottom then
    Bull = 1 //None
    endif

    ThreeInsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishHarami[1] and close>close[1])
    if ThreeInsideUp then
    Bull = 1 //Positive
    endif

    ThreeOutsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishEngulfing[1] and close>close[1])
    if ThreeOutsideUp then
    Bull = 1 //Positive
    endif

    ThreeWhiteSoldiers=(body[2]>0 and body[1]>0 and body>0 and high[1]>high[2] and high>high[1] and close[1]>close[2] and close>close[1] and open[1]>open[2] and open[1]<close[2] and open>open[1] and open<close[1])
    if ThreeWhiteSoldiers then
    //Bull = 1 //Increase Drawdown
    endif

    ConcealingBabySwallow=(body[3]<0 and body[2]<0 and body[1]<0 and body<0 and ratio[3]>0.8 and ratio[2]>0.8 and ratio>0.8 and open[1]<close[2] and high[1]>close[2] and shadowtop[1]>0.6*(abody[1]+shadowbottom[1]) and bodybottom<bodybottom[1] and bodytop>high[1])
    if ConcealingBabySwallow then
    Bull = 1 //None
    endif

    BullishHarami=(body[1]<0 and body>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if BullishHarami then
    //Bull = 1 //Negative Impact
    endif

    HomingPigeon=(body[1]<0 and body<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if HomingPigeon then
    Bull = 1 //None
    endif

    BullishEngulfing=(body[1]<0 and body>0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if BullishEngulfing then
    Bull = 1 //Positive
    endif

    LastEngulfingBottom=(body[1]>0 and body<0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if LastEngulfingBottom then
    Bull = 1 //None
    endif

    DragonflyDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>3*abody and shadowtop<shadowbottom/3)
    if DragonflyDojiBottom then
    Bull = 1 //None
    endif

    GravestoneDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>3*abody and shadowbottom<shadowtop/3)
    if GravestoneDojiBottom then
    Bull = 1 //None
    endif

    DojiStarBottom=(body[1]<0 AND longcandle[1] AND low<low[1] AND open<close[1] AND ratio<0.3 AND range<0.3*range[1])
    if DojiStarBottom then
    Bull = 1 //None
    endif

    BullishHaramiCross=(body[1]<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1])
    if BullishHaramiCross then
    Bull = 1 //None
    endif

    ThreeStarsInTheSouth=(body[2]<0 and body[1]<0 and body<0 and shadowtop[2]<range[2]/4 and shadowbottom[2]>abody[2]/2 and low[1]>low[2] and high[1]<high[2] and abody[1]<abody[2] and shadowtop[1]<range[1]/4 and shadowbottom[1]>abody[1]/2 and low>low[1] and high<high[1] and abody<abody[1] and shadowtop<range/4 and shadowbottom<range/4)
    if ThreeStarsInTheSouth then
    Bull = 1 //None
    endif

    BullishBreakaway=(body[4]<0 and body[3]<0 and body>0 and open[3]<close[4] and close[2]<close[3] and close[1]<close[2] and longcandle and close<close[4] and close>open[3])
    if BullishBreakaway then
    Bull = 1 //None
    endif

    Hammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
    if Hammer then
    Bull = 1 //None
    endif

    InvertedHammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
    if InvertedHammer then
    Bull = 1 //None
    endif

    RisingThreeMethods=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and longcandle and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
    if RisingThreeMethods then
    Bull = 1 //None
    endif

    BullishThreeLineStrike=(body[3]>0 and body[2]>0 and body[1]>0 and body<0 and longcandle[3] and longcandle[2] and longcandle[1] and close[2]>close[3] and close[1]>close[2] and open>close[1] and close<open[3])
    if BullishThreeLineStrike then
    Bull = 1 //None
    endif

    BullishMatHold=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and close[3]>close[4] and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
    if BullishMatHold then
    Bull = 1 //None
    endif

    BullSash=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>close[1] AND open<open[1] AND close>open[1] AND shadowtop<0.1*abody)
    if BullSash then
    Bull = 1 //Positive
    endif

    BullSeparatingLine=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop<0.1*abody)
    if BullSeparatingLine then
    Bull = 1 //None
    endif

    BullishCounterAttack=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND close<=close[1])
    if BullishCounterAttack then
    Bull = 1 //None
    endif

    BullishKicking=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop=0 AND shadowbottom=0)
    if BullishKicking then
    Bull = 1 //None
    endif

    //Bearish Signal

    EveningStar=(body[2]>0 AND body<0 and longcandle[2] and open[1]>close[2] and open<close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and high[1]>high and high[1]>high[2] and low[1]>open[2] and low[1]>close)
    if EveningStar then
    Bear = 1
    endif

    DarkCloudCover=(body[1]>0 and body<0 and longcandle[1] and longcandle and open>high[1] and close<middle[1] and close>open[1])
    if DarkCloudCover then
    Bear = 1
    endif

    AbandonedBabyTop=(body[2]>0 and body<0 and longcandle[2] and ratio[1]<0.3 and low[1]>high[2] and low[1]>high)
    if AbandonedBabyTop then
    Bear = 1
    endif

    ThreeInsideDown=(body[2]>0 and body[1]<0 and body<0 and bearishharami[1] and close<close[1])
    if ThreeInsideDown then
    Bear = 1
    endif

    ThreeOutsideDown=(body[2]>0 and body[1]<0 and body<0 and bearishengulfing[1] and close<close[1])
    if ThreeOutsideDown then
    Bear = 1
    endif

    ThreeBlackCrows=(body[2]<0 and body[1]<0 and body<0 and longcandle[2] and longcandle[1] and longcandle and low[1]<low[2] and low<low[1] and close[1]<close[2] and close<close[1] and open[1]<open[2] and open[1]>close[2] and open<open[1] and open>close[1])
    if ThreeBlackCrows then
    Bear = 1
    endif

    UpsideGapTwoCrows=(body[2]>0 and body[1]<0 and body<0 and longcandle[2] and open[1]>close[2] and bodytop>bodytop[1] and bodybottom<bodybottom[1] and close>close[2])
    if UpsideGapTwoCrows then
    Bear = 1
    endif

    BearishHarami=(body[1]>0 and body<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if BearishHarami then
    Bear = 1
    endif

    DescendingHawk=(body[1]>0 and body>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if DescendingHawk then
    Bear = 1
    endif

    BearishEngulfing=(body[1]>0 and body<0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if BearishEngulfing then
    Bear = 1
    endif

    LastEngulfingTop=(body[1]<0 and body>0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if LastEngulfingTop then
    Bear = 1
    endif

    DragonflyDojiTop=(body[1]>0 and longcandle[1] and high>high[1] and shadowbottom>3*abody and shadowtop<shadowbottom/3)
    if DragonflyDojiTop then
    Bear = 1
    endif

    GravestoneDojiTop=(body[1]>0 and longcandle[1] and high>high[1] and shadowtop>3*abody and shadowbottom<shadowtop/3)
    if GravestoneDojiTop then
    Bear = 1
    endif

    DojiStarTop=(body[1]>0 AND longcandle[1] AND high>high[1] AND open>close[1] AND ratio<0.3 AND range<0.3*range[1])
    if DojiStarTop then
    Bear = 1
    endif

    BearishHaramiCross=(body[1]>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1])
    if BearishHaramiCross then
    Bear = 1
    endif

    AdvanceBlock=(body[2]>0 and body[1]>0 and body>0 and high[2]<high[1] and high[1]<high and open[1]>bodybottom[2] and open[1]<bodytop[2] and open>bodybottom[1] and open<bodytop[1] and abody[1]<abody[2] and abody<abody[1])
    if AdvanceBlock then
    Bear = 1
    endif

    TwoCrows=(body[2]>0 and body[1]<0 and body<0 and longcandle[2] and open[1]>close[2] and close[1]>close[2] and open<bodytop[1] and open>bodybottom[1] and close<bodytop[2] and close>bodybottom[2])
    if TwoCrows then
    Bear = 1
    endif

    BearishBreakaway=(body[4]>0 and body[3]>0 and body<0 and open[3]>close[4] and close[2]>close[3] and close[1]>close[2] and longcandle and close>close[4] and close<open[3])
    if BearishBreakaway then
    Bear = 1
    endif

    ShootingStar=(body[1]>0 and longcandle[1] and high>high[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
    if ShootingStar then
    Bear = 1
    endif

    HangingMan=(body[1]>0 and longcandle[1] and high>high[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
    if HangingMan then
    Bear = 1
    endif

    FallingThreeMethods=(body[4]<0 and body[3]>0 and body[1]>0 and body<0 and longcandle[4] and longcandle and close[2]>close[3] and close[1]>close[2] and low[2]>low[3] and low[1]>low[2] and high[1]<high[4] and open<close[1] and close<low[4] and close<low[3] and close<low[2] and close<low[1])
    if FallingThreeMethods then
    Bear = 1
    endif

    BearishThreeLineStrike=(body[3]<0 and body[2]<0 and body[1]<0 and body>0 and longcandle[3] and longcandle[2] and longcandle[1] and close[2]<close[3] and close[1]<close[2] and open<close[1] and close>open[3])
    if BearishThreeLineStrike then
    Bear = 1
    endif

    BearishMatHold=(body[4]<0 and body[3]>0 and body[1]>0 and body<0 and longcandle[4] and close[3]<close[4] and close[2]>close[3] and close[1]>close[2] and low[2]>low[3] and low[1]>low[2] and high[1]<high[4] and open<close[1] and close<low[4] and close<low[3] and close<low[2] and close<low[1])
    if BearishMatHold then
    Bear = 1
    endif

    BearSash=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open>open[1] AND open<close[1] AND close<open[1] AND shadowbottom<0.1*abody)
    if BearSash then
    Bear = 1
    endif

    BearSeparatingLine=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open<=open[1] AND shadowbottom<0.1*abody)
    if BearSeparatingLine then
    Bear = 1
    endif

    BearishCounterAttack=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND close>=close[1])
    if BearishCounterAttack then
    Bear = 1
    endif

    BearishKicking=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open<=open[1] AND shadowtop=0 AND shadowbottom=0)
    if BearishKicking then
    Bear = 1
    endif

    //Entry/Exit Criteria

    possize = 1

    NearMA = Average[7,2](close)

    If countofposition = 0 and Bull = 1 and NearMA[1] > NearMA[3] and RSI[2](close) > 75 and NearMA > Average[150,2](close) and timeEnterBefore and timeEnterAfter and not daysForbiddenEntry Then
    //If shortonmarket Then
    //Exitshort at market
    //EndIf
    Buy possize contract at market
    EndIf

    If countofposition = 0 and Bear = 1 and NearMA[1] < NearMA[3] and RSI[2](close) < 25 and NearMA < Average[150,2](close) Then
    //If longonmarket Then
    //Sell at market
    //EndIf
    //Sellshort possize contract at market
    EndIf

    Set Target pProfit 10
    Set Stop pLoss 50

    #47993 quote
    juanj
    Participant
    Master

    What market are you using it for?

    My suggestion was that you need to include the whole piece of code in an IF statement. For example:

    Line 1: If dayofweek > 0 and dayofweek < 6 Then

    Last Line: EndIf

    #48092 quote
    raphaelopilski
    Participant
    Senior

    I use it for eur/usd and still have the same divided through zero problem….

    #48108 quote
    robertogozzi
    Moderator
    Master

    fabioerliam, you should use the “Insert PRT code” button (<> icon) on the grey bar to make your code more readable, like that:

    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    noEntryBeforeTime = 090000
    timeEnterBefore = time >= noEntryBeforeTime
    
    noEntryAfterTime = 173000
    timeEnterAfter = time < noEntryAfterTime
    
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    If longonmarket and close < positionprice and (barindex-tradeindex) > 650 Then
    Sell at market
    ElsIf shortonmarket and close > positionprice and (barindex-tradeindex) > 60 then
    Exitshort at market
    EndIf
    
    body=close-open
    
    abody=abs(body)
    
    if range>0.1 then
    ratio=abody/range
    else
    ratio=0
    endif
    
    middle=(open+close)/2
    
    bodytop=max(open, close)
    
    bodybottom=min(open, close)
    
    shadowtop=high-bodytop
    
    shadowbottom=bodybottom-low
    
    longcandle= (ratio>0.6)
    
    Bull = 0
    Bear = 0
    
    //Bullish Signals
    
    MorningStar=(body[2]<0 and body>0 and longcandle[2] and open[1]<close[2] and open>close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and low[1]<low and low[1]<low[2] and high[1]<open[2] and high[1]<close)
    if MorningStar then
    Bull = 1 //Positive
    endif
    
    PiercingLine=(body[1]<0 and body>0 and longcandle[1] and longcandle and open<low[1] and close>middle[1] and close<open[1])
    if PiercingLine then
    Bull = 1 //None
    endif
    
    AbandonedBabyBottom=(body[2]<0 and body>0 and longcandle[2] and ratio[1]<0.3 and high[1]<low[2] and high[1]<low)
    if AbandonedBabyBottom then
    Bull = 1 //None
    endif
    
    ThreeInsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishHarami[1] and close>close[1])
    if ThreeInsideUp then
    Bull = 1 //Positive
    endif
    
    ThreeOutsideUp=(body[2]<0 and body[1]>0 and body>0 and BullishEngulfing[1] and close>close[1])
    if ThreeOutsideUp then
    Bull = 1 //Positive
    endif
    
    ThreeWhiteSoldiers=(body[2]>0 and body[1]>0 and body>0 and high[1]>high[2] and high>high[1] and close[1]>close[2] and close>close[1] and open[1]>open[2] and open[1]<close[2] and open>open[1] and open<close[1])
    if ThreeWhiteSoldiers then
    //Bull = 1 //Increase Drawdown
    endif
    
    ConcealingBabySwallow=(body[3]<0 and body[2]<0 and body[1]<0 and body<0 and ratio[3]>0.8 and ratio[2]>0.8 and ratio>0.8 and open[1]<close[2] and high[1]>close[2] and shadowtop[1]>0.6*(abody[1]+shadowbottom[1]) and bodybottom<bodybottom[1] and bodytop>high[1])
    if ConcealingBabySwallow then
    Bull = 1 //None
    endif
    
    BullishHarami=(body[1]<0 and body>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if BullishHarami then
    //Bull = 1 //Negative Impact
    endif
    
    HomingPigeon=(body[1]<0 and body<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if HomingPigeon then
    Bull = 1 //None
    endif
    
    BullishEngulfing=(body[1]<0 and body>0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if BullishEngulfing then
    Bull = 1 //Positive
    endif
    
    LastEngulfingBottom=(body[1]>0 and body<0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if LastEngulfingBottom then
    Bull = 1 //None
    endif
    
    DragonflyDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>3*abody and shadowtop<shadowbottom/3)
    if DragonflyDojiBottom then
    Bull = 1 //None
    endif
    
    GravestoneDojiBottom=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>3*abody and shadowbottom<shadowtop/3)
    if GravestoneDojiBottom then
    Bull = 1 //None
    endif
    
    DojiStarBottom=(body[1]<0 AND longcandle[1] AND low<low[1] AND open<close[1] AND ratio<0.3 AND range<0.3*range[1])
    if DojiStarBottom then
    Bull = 1 //None
    endif
    
    BullishHaramiCross=(body[1]<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1])
    if BullishHaramiCross then
    Bull = 1 //None
    endif
    
    ThreeStarsInTheSouth=(body[2]<0 and body[1]<0 and body<0 and shadowtop[2]<range[2]/4 and shadowbottom[2]>abody[2]/2 and low[1]>low[2] and high[1]<high[2] and abody[1]<abody[2] and shadowtop[1]<range[1]/4 and shadowbottom[1]>abody[1]/2 and low>low[1] and high<high[1] and abody<abody[1] and shadowtop<range/4 and shadowbottom<range/4)
    if ThreeStarsInTheSouth then
    Bull = 1 //None
    endif
    
    BullishBreakaway=(body[4]<0 and body[3]<0 and body>0 and open[3]<close[4] and close[2]<close[3] and close[1]<close[2] and longcandle and close<close[4] and close>open[3])
    if BullishBreakaway then
    Bull = 1 //None
    endif
    
    Hammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
    if Hammer then
    Bull = 1 //None
    endif
    
    InvertedHammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
    if InvertedHammer then
    Bull = 1 //None
    endif
    
    RisingThreeMethods=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and longcandle and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
    if RisingThreeMethods then
    Bull = 1 //None
    endif
    
    BullishThreeLineStrike=(body[3]>0 and body[2]>0 and body[1]>0 and body<0 and longcandle[3] and longcandle[2] and longcandle[1] and close[2]>close[3] and close[1]>close[2] and open>close[1] and close<open[3])
    if BullishThreeLineStrike then
    Bull = 1 //None
    endif
    
    BullishMatHold=(body[4]>0 and body[3]<0 and body[1]<0 and body>0 and longcandle[4] and close[3]>close[4] and close[2]<close[3] and close[1]<close[2] and high[2]<high[3] and high[1]<high[2] and low[1]>low[4] and open>close[1] and close>high[4] and close>high[3] and close>high[2] and close>high[1])
    if BullishMatHold then
    Bull = 1 //None
    endif
    
    BullSash=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>close[1] AND open<open[1] AND close>open[1] AND shadowtop<0.1*abody)
    if BullSash then
    Bull = 1 //Positive
    endif
    
    BullSeparatingLine=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop<0.1*abody)
    if BullSeparatingLine then
    Bull = 1 //None
    endif
    
    BullishCounterAttack=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND close<=close[1])
    if BullishCounterAttack then
    Bull = 1 //None
    endif
    
    BullishKicking=(body[1]<0 AND longcandle[1] AND body>0 AND longcandle AND open>=open[1] AND shadowtop=0 AND shadowbottom=0)
    if BullishKicking then
    Bull = 1 //None
    endif
    
    //Bearish Signal
    
    EveningStar=(body[2]>0 AND body<0 and longcandle[2] and open[1]>close[2] and open<close[1] and ratio[1]<0.3 and abody[1]<abody[2] and abody[1]<abody and high[1]>high and high[1]>high[2] and low[1]>open[2] and low[1]>close)
    if EveningStar then
    Bear = 1
    endif
    
    DarkCloudCover=(body[1]>0 and body<0 and longcandle[1] and longcandle and open>high[1] and close<middle[1] and close>open[1])
    if DarkCloudCover then
    Bear = 1
    endif
    
    AbandonedBabyTop=(body[2]>0 and body<0 and longcandle[2] and ratio[1]<0.3 and low[1]>high[2] and low[1]>high)
    if AbandonedBabyTop then
    Bear = 1
    endif
    
    ThreeInsideDown=(body[2]>0 and body[1]<0 and body<0 and bearishharami[1] and close<close[1])
    if ThreeInsideDown then
    Bear = 1
    endif
    
    ThreeOutsideDown=(body[2]>0 and body[1]<0 and body<0 and bearishengulfing[1] and close<close[1])
    if ThreeOutsideDown then
    Bear = 1
    endif
    
    ThreeBlackCrows=(body[2]<0 and body[1]<0 and body<0 and longcandle[2] and longcandle[1] and longcandle and low[1]<low[2] and low<low[1] and close[1]<close[2] and close<close[1] and open[1]<open[2] and open[1]>close[2] and open<open[1] and open>close[1])
    if ThreeBlackCrows then
    Bear = 1
    endif
    
    UpsideGapTwoCrows=(body[2]>0 and body[1]<0 and body<0 and longcandle[2] and open[1]>close[2] and bodytop>bodytop[1] and bodybottom<bodybottom[1] and close>close[2])
    if UpsideGapTwoCrows then
    Bear = 1
    endif
    
    BearishHarami=(body[1]>0 and body<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if BearishHarami then
    Bear = 1
    endif
    
    DescendingHawk=(body[1]>0 and body>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1])
    if DescendingHawk then
    Bear = 1
    endif
    
    BearishEngulfing=(body[1]>0 and body<0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if BearishEngulfing then
    Bear = 1
    endif
    
    LastEngulfingTop=(body[1]<0 and body>0 and bodybottom<bodybottom[1] and bodytop>bodytop[1] and longcandle)
    if LastEngulfingTop then
    Bear = 1
    endif
    
    DragonflyDojiTop=(body[1]>0 and longcandle[1] and high>high[1] and shadowbottom>3*abody and shadowtop<shadowbottom/3)
    if DragonflyDojiTop then
    Bear = 1
    endif
    
    GravestoneDojiTop=(body[1]>0 and longcandle[1] and high>high[1] and shadowtop>3*abody and shadowbottom<shadowtop/3)
    if GravestoneDojiTop then
    Bear = 1
    endif
    
    DojiStarTop=(body[1]>0 AND longcandle[1] AND high>high[1] AND open>close[1] AND ratio<0.3 AND range<0.3*range[1])
    if DojiStarTop then
    Bear = 1
    endif
    
    BearishHaramiCross=(body[1]>0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1])
    if BearishHaramiCross then
    Bear = 1
    endif
    
    AdvanceBlock=(body[2]>0 and body[1]>0 and body>0 and high[2]<high[1] and high[1]<high and open[1]>bodybottom[2] and open[1]<bodytop[2] and open>bodybottom[1] and open<bodytop[1] and abody[1]<abody[2] and abody<abody[1])
    if AdvanceBlock then
    Bear = 1
    endif
    
    TwoCrows=(body[2]>0 and body[1]<0 and body<0 and longcandle[2] and open[1]>close[2] and close[1]>close[2] and open<bodytop[1] and open>bodybottom[1] and close<bodytop[2] and close>bodybottom[2])
    if TwoCrows then
    Bear = 1
    endif
    
    BearishBreakaway=(body[4]>0 and body[3]>0 and body<0 and open[3]>close[4] and close[2]>close[3] and close[1]>close[2] and longcandle and close>close[4] and close<open[3])
    if BearishBreakaway then
    Bear = 1
    endif
    
    ShootingStar=(body[1]>0 and longcandle[1] and high>high[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
    if ShootingStar then
    Bear = 1
    endif
    
    HangingMan=(body[1]>0 and longcandle[1] and high>high[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
    if HangingMan then
    Bear = 1
    endif
    
    FallingThreeMethods=(body[4]<0 and body[3]>0 and body[1]>0 and body<0 and longcandle[4] and longcandle and close[2]>close[3] and close[1]>close[2] and low[2]>low[3] and low[1]>low[2] and high[1]<high[4] and open<close[1] and close<low[4] and close<low[3] and close<low[2] and close<low[1])
    if FallingThreeMethods then
    Bear = 1
    endif
    
    BearishThreeLineStrike=(body[3]<0 and body[2]<0 and body[1]<0 and body>0 and longcandle[3] and longcandle[2] and longcandle[1] and close[2]<close[3] and close[1]<close[2] and open<close[1] and close>open[3])
    if BearishThreeLineStrike then
    Bear = 1
    endif
    
    BearishMatHold=(body[4]<0 and body[3]>0 and body[1]>0 and body<0 and longcandle[4] and close[3]<close[4] and close[2]>close[3] and close[1]>close[2] and low[2]>low[3] and low[1]>low[2] and high[1]<high[4] and open<close[1] and close<low[4] and close<low[3] and close<low[2] and close<low[1])
    if BearishMatHold then
    Bear = 1
    endif
    
    BearSash=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open>open[1] AND open<close[1] AND close<open[1] AND shadowbottom<0.1*abody)
    if BearSash then
    Bear = 1
    endif
    
    BearSeparatingLine=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open<=open[1] AND shadowbottom<0.1*abody)
    if BearSeparatingLine then
    Bear = 1
    endif
    
    BearishCounterAttack=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND close>=close[1])
    if BearishCounterAttack then
    Bear = 1
    endif
    
    BearishKicking=(body[1]>0 AND longcandle[1] AND body<0 AND longcandle AND open<=open[1] AND shadowtop=0 AND shadowbottom=0)
    if BearishKicking then
    Bear = 1
    endif
    
    //Entry/Exit Criteria
    
    possize = 1
    
    NearMA = Average[7,2](close)
    
    If countofposition = 0 and Bull = 1 and NearMA[1] > NearMA[3] and RSI[2](close) > 75 and NearMA > Average[150,2](close) and timeEnterBefore and timeEnterAfter and not daysForbiddenEntry Then
    //If shortonmarket Then
    //Exitshort at market
    //EndIf
    Buy possize contract at market
    EndIf
    
    If countofposition = 0 and Bear = 1 and NearMA[1] < NearMA[3] and RSI[2](close) < 25 and NearMA < Average[150,2](close) Then
    //If longonmarket Then
    //Sell at market
    //EndIf
    //Sellshort possize contract at market
    EndIf
    
    Set Target pProfit 10
    Set Stop pLoss 50

    Roberto

    #48352 quote
    ozz87
    Participant
    Senior

    Tried an optimization for CAC. Changed it to not trade on mondays or thursdays. I can only backtest to 20 juni though, requires premium prt to backtest further?

    1-min-strat-CAC.itf 1min_cac.png 1min_cac.png
    #48356 quote
    ozz87
    Participant
    Senior

    DAX without mondays and thursdays, changed SL abit.

    reb thanked this post
    1-min-strat-DAX.itf 1min_dax.png 1min_dax.png
    #48364 quote
    ozz87
    Participant
    Senior

    Also DOW with time changed for US. Thursdays exluded. Forgot to mention the contract size is changed to 2 in the codes I posted…

    reb thanked this post
    1-min-strat-DOW.itf 1min_dow.png 1min_dow.png
    #48405 quote
    Despair
    Blocked
    Master

    @ozz87: Did you run WFA of this new versions you made? If you have WFA results it is always appreciated if you them also.

    #48417 quote
    ozz87
    Participant
    Senior

    Despair: Sure. But the problem remains that I only can backtest to about July.

    I haven’t fully understood the WFA function, so I use the settings I found in the prt-guide. Does this look ok?

    WFA_1mindax.png WFA_1mindax.png
    #48421 quote
    Despair
    Blocked
    Master

    What are this for variables you are optimizing? asd, asdasd, asdasdasd? Does this variables exist in your code and if so what do they stand for? If this variables don’t exist in your code you are creating an illusion. You should always run your WFA with the most influential variables of your strategy. On this strategy there are not many variables to use except TP, SL and maybe the period of the MAs.

    So I’m little curious what you do with this new and variables. 🙂

    #48425 quote
    ozz87
    Participant
    Senior

    Despair: I have no idea what they mean. Haven’t done WF before 🙂 So this one is testing the stoploss? Taking forever to do the test.

    WFA_1mindax-1.png WFA_1mindax-1.png
    #48432 quote
    Despair
    Blocked
    Master

    @ozz87: I think you should read a little bit on WFA so you understand how it is working. There are many good books.

    And yes, WFA takes very long, especially on short timeframes.

    #48449 quote
    ozz87
    Participant
    Senior

    Despair: That recommendation is good…. Read some about it and I think I understand the concept. Anyway, I can do the tests on the codes I posted if you want, but I’d need your help on how the variables should be then 😉

    #48450 quote
    Despair
    Blocked
    Master

    If you need that help still after reading you should read it again. 😉 No offense but that’s the way it is.

    To learn how to test strategies is mandatory if you want to get anywhere in strategy development. Producing a fancy looking BT is easy but to create a test that actually means something is a different story.

    #48460 quote
    Nicolas
    Keymaster
    Master
Viewing 15 posts - 151 through 165 (of 220 total)
  • You must be logged in to reply to this topic.

1 Min Trading Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
juanj @juanj Participant
Summary

This topic contains 219 replies,
has 29 voices, and was last updated by Leo
8 years, 2 months ago.

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