Stratégie multi indices en 10′ (secondes)

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #149886 quote
    Fantasio2020
    Participant
    Senior

    Bonjour la communauté,

    je partage aujourd’hui une stratégie qui me donne de bon résultats avec un manque de constance d’une semaine à l’autre.

    j’atteint mes limite en programmation…mais je suis convaincu que la base est est bonne et mérite d’être partagée et améliorée.

    merci de faire part de vos commentaires, amélioration, correction, …

    fonctionne sur plusieurs indices en travaillant sur les variables startingvalue(P,1,2,3,4…)

    //-------------------------------------------------------------------------
    // Définition des paramètres du code
    Defparam CumulateOrders = False
    Defparam Preloadbars = 10000
    Defparam FlatBefore = 153000
    Defparam FlatAfter = 213000
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    //daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    //************************************************************************
    // Heuristics Algorithm P Start
    If (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) Then
    optimizeP = optimizeP + 1
    EnDif
    
    StartingValueP = 10
    ResetPeriodP = 5 //Specify no of days after which to reset optimization
    IncrementP = 1
    MaxIncrementP = 3 //Limit of no of IncrementPs either up or down
    RepsP = 3 //Number of trades to use for analysis
    MaxValueP = 12 //Maximum allowed value
    MinValueP = 9 //Minimum allowed value
    
    once DayinitP = day
    once MonthinitP = month
    If (month = MonthinitP and day = (DayinitP + ResetPeriodP)) or (month = (MonthinitP + 1) and ((month - DayinitP) + day = ResetPeriodP)) Then
    R2LimE = StartingValueP
    WinCountBP = 0
    StratAvgBP = 0
    BestAP = 0
    BestBP = 0
    DayinitP = day
    MonthinitP = month
    EndIf
    
    once P = StartingValueP
    once PincPosP = 1 //Positive IncrementP Position
    once NincPosP = 1 //Neative IncrementP Position
    once optimizeP = 0 ////Initialize Heuristicks Engine Counter (Must be IncrementPed at Position Start or Exit)
    once ModeP = 1 //Switches between negative and positive IncrementPs
    //once WinCountBP = P //Initialize Best Win Count
    //GRAPH WinCountBP coloured (0,0,0) AS "WinCountBP"
    //once StratAvgBP = PP5P //Initialize Best Avg Strategy Profit
    //GRAPH StratAvgBP coloured (0,0,0) AS "StratAvgBP"
    
    If optimizeP = RepsP Then
    WinCountAP = 0 //Initialize current Win Count
    StratAvgAP = 0 //Initialize current Avg Strategy Profit
    
    For iP = 1 to RepsP Do
    If positionperf(iP) > 0 Then
    WinCountAP = WinCountAP + 1 //IncrementP Current WinCount
    EndIf
    StratAvgAP = StratAvgAP + (((PositionPerf(iP)*countofposition[iP]*close)*-1)*-1)
    Next
    StratAvgAP = StratAvgAP/RepsP //Calculate Current Avg Strategy Profit
    //Graph (PositionPerf(1)*countofposition[1]*close)*-1 as "PosPerf1"
    //Graph (PositionPerf(2)*countofposition[2]*close)*-1 as "PosPerf2"
    //Graph StratAvgAP*-1 as "StratAvgAP"
    //once BestAP = P00
    //GRAPH BestAP coloured (0,0,0) AS "BestAP"
    If StratAvgAP >= StratAvgBP Then
    StratAvgBP = StratAvgAP //Update Best Strategy Profit
    BestAP = P
    EndIf
    //once BestBP = P00
    //GRAPH BestBP coloured (0,0,0) AS "BestBP"
    If WinCountAP >= WinCountBP Then
    WinCountBP = WinCountAP  //Update Best Win Count
    BestBP = P
    EndIf
    
    If WinCountAP > WinCountBP and StratAvgAP > StratAvgBP Then
    ModeP = 0
    ElsIf WinCountAP < WinCountBP and StratAvgAP < StratAvgBP and ModeP = 1 Then
    P = P - (IncrementP*NincPosP)
    NincPosP = NincPosP + 1
    ModeP = 2
    ElsIf WinCountAP >= WinCountBP or StratAvgAP >= StratAvgBP and ModeP = 1 Then
    P = P + (IncrementP*PincPosP)
    PincPosP = PincPosP + 1
    ModeP = 1
    ElsIf WinCountAP < WinCountBP and StratAvgAP < StratAvgBP and ModeP = 2 Then
    P = P + (IncrementP*PincPosP)
    PincPosP = PincPosP + 1
    ModeP = 1
    ElsIf WinCountAP >= WinCountBP or StratAvgAP >= StratAvgBP and ModeP = 2 Then
    P = P - (IncrementP*NincPosP)
    NincPosP = NincPosP + 1
    ModeP = 2
    EndIf
    
    If NincPosP > MaxIncrementP or PincPosP > MaxIncrementP Then
    If BestAP = BestBP Then
    P = BestAP
    Else
    If RepsP >= 10 Then
    WeightedScoreP = 10
    Else
    WeightedScoreP = round((RepsP/100)*100)
    EndIf
    P = round(((BestAP*(20-WeightedScoreP)) + (BestBP*WeightedScoreP))/20) //Lower RepsP = Less weight assigned to Win%
    EndIf
    NincPosP = 1
    PincPosP = 1
    ElsIf P > MaxValueP Then
    P = MaxValueP
    ElsIf P < MinValueP Then
    P = MinValueP
    EndIF
    
    optimizeP = 0
    Endif
    // Heuristics Algorithm P End
    //************************************************************************
    // Heuristics Algorithm 1 Start
    If (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) Then
    optimize = optimize + 1
    EnDif
    
    StartingValue = 0.54
    ResetPeriod = 5 //Specify no of hour after which to reset optimization
    Increment = 0.005
    MaxIncrement = 40 //Limit of no of increments either up or down
    Reps = 3 //Number of trades to use for analysis
    MaxValue = 0.6 //Maximum allowed value
    MinValue = 0.4 //Minimum allowed value
    
    once Dayinit = day
    once Monthinit = month
    If (month = Monthinit and day = (Dayinit + ResetPeriod)) or (month = (Monthinit + 1) and ((month - Dayinit) + day = ResetPeriod)) Then
    R2LimE = StartingValue
    WinCountB = 0
    StratAvgB = 0
    BestA = 0
    BestB = 0
    Dayinit = day
    Monthinit = month
    EndIf
    
    once R2LimE = StartingValue
    once PIncPos = 1 //Positive Increment Position
    once NIncPos = 1 //Neative Increment Position
    once Optimize = 0 ////Initialize Heuristicks Engine Counter (Must be Incremented at Position Start or Exit)
    once Mode = 1 //Switches between negative and positive increments
    //once WinCountB = 3 //Initialize Best Win Count
    //GRAPH WinCountB coloured (0,0,0) AS "WinCountB"
    //once StratAvgB = 4353 //Initialize Best Avg Strategy Profit
    //GRAPH StratAvgB coloured (0,0,0) AS "StratAvgB"
    
    If Optimize = Reps Then
    WinCountA = 0 //Initialize current Win Count
    StratAvgA = 0 //Initialize current Avg Strategy Profit
    
    For i = 1 to Reps Do
    If positionperf(i) > 0 Then
    WinCountA = WinCountA + 1 //Increment Current WinCount
    EndIf
    StratAvgA = StratAvgA + (((PositionPerf(i)*countofposition[i]*close)*-1)*-1)
    Next
    StratAvgA = StratAvgA/Reps //Calculate Current Avg Strategy Profit
    //Graph (PositionPerf(1)*countofposition[1]*close)*-1 as "PosPerf1"
    //Graph (PositionPerf(2)*countofposition[2]*close)*-1 as "PosPerf2"
    //Graph StratAvgA*-1 as "StratAvgA"
    //once BestA = 300
    //GRAPH BestA coloured (0,0,0) AS "BestA"
    If StratAvgA >= StratAvgB Then
    StratAvgB = StratAvgA //Update Best Strategy Profit
    BestA = R2LimE
    EndIf
    //once BestB = 300
    //GRAPH BestB coloured (0,0,0) AS "BestB"
    If WinCountA >= WinCountB Then
    WinCountB = WinCountA  //Update Best Win Count
    BestB = R2LimE
    EndIf
    
    If WinCountA > WinCountB and StratAvgA > StratAvgB Then
    Mode = 0
    ElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode = 1 Then
    R2LimE = R2LimE - (Increment*NIncPos)
    NIncPos = NIncPos + 1
    Mode = 2
    ElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode = 1 Then
    R2LimE = R2LimE + (Increment*PIncPos)
    PIncPos = PIncPos + 1
    Mode = 1
    ElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode = 2 Then
    R2LimE = R2LimE + (Increment*PIncPos)
    PIncPos = PIncPos + 1
    Mode = 1
    ElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode = 2 Then
    R2LimE = R2LimE - (Increment*NIncPos)
    NIncPos = NIncPos + 1
    Mode = 2
    EndIf
    
    If NIncPos > MaxIncrement or PIncPos > MaxIncrement Then
    If BestA = BestB Then
    R2LimE = BestA
    Else
    If reps >= 10 Then
    WeightedScore = 10
    Else
    WeightedScore = round((reps/100)*100)
    EndIf
    R2LimE = round(((BestA*(20-WeightedScore)) + (BestB*WeightedScore))/20) //Lower Reps = Less weight assigned to Win%
    EndIf
    NIncPos = 1
    PIncPos = 1
    ElsIf R2LimE > MaxValue Then
    R2LimE = MaxValue
    ElsIf R2LimE < MinValue Then
    R2LimE = MinValue
    EndIF
    
    Optimize = 0
    EndIf
    // Heuristics Algorithm 1 End
    //************************************************************************
    // Heuristics Algorithm 2 Start
    If (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) Then
    optimize2 = optimize2 + 1
    Endif
    
    StartingValue2 = 0.7
    ResetPeriod2 = 5 //Specify no of months after which to reset optimization
    Increment2 = 0.005
    MaxIncrement2 = 40 //Limit of no of increments either up or down
    Reps2 = 3 //Number of trades to use for analysis
    MaxValue2 = 0.8 //Maximum allowed value
    MinValue2 = 0.6 //Minimum allowed value
     
    once Dayinit2 = day
    once Monthinit2 = month
    If (month = Monthinit2 and day = (Dayinit2 + ResetPeriod2)) or (month = (Monthinit2 + 1) and ((month - Dayinit2) + day = ResetPeriod2)) Then
    R2LimS = StartingValue2
    WinCountB2 = 0
    StratAvgB2 = 0
    BestA2 = 0
    BestB2 = 0
    Dayinit2 = Hour
    Monthinit2 = Day
    EndIf
    
    once R2LimS = StartingValue2
    once PIncPos2 = 1 //Positive Increment Position
    once NIncPos2 = 1 //Neative Increment Position
    once Optimize2 = 0 ////Initialize Heuristicks Engine Counter (Must be Incremented at Position Start or Exit)
    once Mode2 = 1 //Switches between negative and positive increments
    //once WinCountB2 = 3 //Initialize Best Win Count
    //GRAPH WinCountB2 coloured (0,0,0) AS "WinCountB2"
    //once StratAvgB2 = 4353 //Initialize Best Avg Strategy Profit
    //GRAPH StratAvgB2 coloured (0,0,0) AS "StratAvgB2"
     
    If Optimize2 = Reps2 Then
    WinCountA2 = 0 //Initialize current Win Count
    StratAvgA2 = 0 //Initialize current Avg Strategy Profit
     
    For i2 = 1 to Reps2 Do
    If positionperf(i2) > 0 Then
    WinCountA2 = WinCountA2 + 1 //Increment Current WinCount
    EndIf
    StratAvgA2 = StratAvgA2 + (((PositionPerf(i2)*countofposition[i2]*close)*-1)*-1)
    Next
    StratAvgA2 = StratAvgA2/Reps2 //Calculate Current Avg Strategy Profit
    //Graph (PositionPerf(1)*countofposition[1]*close)*-1 as "PosPerf1-2"
    //Graph (PositionPerf(2)*countofposition[2]*close)*-1 as "PosPerf2-2"
    //Graph StratAvgA2*-1 as "StratAvgA2"
    //once BestA2 = 300
    //GRAPH BestA2 coloured (0,0,0) AS "BestA2"
    If StratAvgA2 >= StratAvgB2 Then
    StratAvgB2 = StratAvgA2 //Update Best Strategy Profit
    BestA2 = R2LimS
    EndIf
    //once BestB2 = 300
    //GRAPH BestB2 coloured (0,0,0) AS "BestB2"
    If WinCountA2 >= WinCountB2 Then
    WinCountB2 = WinCountA2  //Update Best Win Count
    BestB2 = R2LimS
    EndIf
     
    If WinCountA2 > WinCountB2 and StratAvgA2 > StratAvgB2 Then
    Mode2 = 0
    ElsIf WinCountA2 < WinCountB2 and StratAvgA2 < StratAvgB2 and Mode2 = 1 Then
    R2LimS = R2LimS - (Increment2*NIncPos2)
    NIncPos2 = NIncPos2 + 1
    Mode2 = 2
    ElsIf WinCountA2 >= WinCountB2 or StratAvgA2 >= StratAvgB2 and Mode2 = 1 Then
    R2LimS = R2LimS + (Increment2*PIncPos2)
    PIncPos2 = PIncPos2 + 1
    Mode2 = 1
    ElsIf WinCountA2 < WinCountB2 and StratAvgA2 < StratAvgB2 and Mode2 = 2 Then
    R2LimS = R2LimS + (Increment2*PIncPos2)
    PIncPos2 = PIncPos2 + 1
    Mode2 = 1
    ElsIf WinCountA2 >= WinCountB2 or StratAvgA2 >= StratAvgB2 and Mode2 = 2 Then
    R2LimS = R2LimS - (Increment2*NIncPos2)
    NIncPos2 = NIncPos2 + 1
    Mode2 = 2
    EndIf
     
    If NIncPos2 > MaxIncrement2 or PIncPos2 > MaxIncrement2 Then
    If BestA2 = BestB2 Then
    R2LimS = BestA2
    Else
    If reps2 >= 10 Then
    WeightedScore2 = 10
    Else
    WeightedScore2 = round((reps2/100)*100)
    EndIf
    R2LimS = round(((BestA2*(20-WeightedScore2)) + (BestB2*WeightedScore2))/20) //Lower Reps = Less weight assigned to Win%
    EndIf
    NIncPos2 = 1
    PIncPos2 = 1
    ElsIf R2LimS > MaxValue2 Then
    R2LimS = MaxValue2
    ElsIf R2LimS < MinValue2 Then
    R2LimS = MinValue2
    EndIF
     
    Optimize2 = 0
    EndIf
    // Heuristics Algorithm 2 End
    //************************************************************************
    // Heuristics Algorithm 3 Start
    If (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) Then
    optimize3 = optimize3 + 1
    EnDif
    
    StartingValue3 = 5.6
    ResetPeriod3 = 5 //Specify no of hour after which to reset optimization
    Increment3 = 0.2
    MaxIncrement3 = 15 //Limit of no of Increment3s either up or down
    Reps3 = 3 //Number of trades to use for analysis
    MaxValue3 = 7 //Maximum allowed value
    MinValue3 = 4 //Minimum allowed value
    
    once Dayinit3 = day
    once Monthinit3 = month
    If (month = Monthinit3 and day = (Dayinit3 + ResetPeriod3)) or (month = (Monthinit3 + 1) and ((month - Dayinit3) + day = ResetPeriod3)) Then
    TrailingStart = StartingValue3
    WinCountB3 = 0
    StratAvgB3 = 0
    BestA3 = 0
    BestB3 = 0
    Dayinit3 = day
    Monthinit3 = month
    EndIf
    
    once TrailingStart = StartingValue3
    once PincPos3 = 1 //Positive Increment3 Position
    once NincPos3 = 1 //Neative Increment3 Position
    once optimize3 = 0 ////Initialize Heuristicks Engine Counter (Must be Increment3ed at Position Start or Exit)
    once Mode3 = 1 //Switches between negative and positive Increment3s
    //once WinCountB3 = 3 //Initialize Best Win Count
    //GRAPH WinCountB3 coloured (0,0,0) AS "WinCountB3"
    //once StratAvgB3 = 4353 //Initialize Best Avg Strategy Profit
    //GRAPH StratAvgB3 coloured (0,0,0) AS "StratAvgB3"
    
    If optimize3 = Reps3 Then
    WinCountA3 = 0 //Initialize current Win Count
    StratAvgA3 = 0 //Initialize current Avg Strategy Profit
    
    For i3 = 1 to Reps3 Do
    If positionperf(i3) > 0 Then
    WinCountA3 = WinCountA3 + 1 //Increment3 Current WinCount
    EndIf
    StratAvgA3 = StratAvgA3 + (((PositionPerf(i3)*countofposition[i3]*close)*-1)*-1)
    Next
    StratAvgA3 = StratAvgA3/Reps3 //Calculate Current Avg Strategy Profit
    //Graph (PositionPerf(1)*countofposition[1]*close)*-1 as "PosPerf1"
    //Graph (PositionPerf(2)*countofposition[2]*close)*-1 as "PosPerf2"
    //Graph StratAvgA3*-1 as "StratAvgA3"
    //once BestA3 = 300
    //GRAPH BestA3 coloured (0,0,0) AS "BestA3"
    If StratAvgA3 >= StratAvgB3 Then
    StratAvgB3 = StratAvgA3 //Update Best Strategy Profit
    BestA3 = TrailingStart
    EndIf
    //once BestB3 = 300
    //GRAPH BestB3 coloured (0,0,0) AS "BestB3"
    If WinCountA3 >= WinCountB3 Then
    WinCountB3 = WinCountA3  //Update Best Win Count
    BestB3 = TrailingStart
    EndIf
    
    If WinCountA3 > WinCountB3 and StratAvgA3 > StratAvgB3 Then
    Mode3 = 0
    ElsIf WinCountA3 < WinCountB3 and StratAvgA3 < StratAvgB3 and Mode3 = 1 Then
    TrailingStart = TrailingStart - (Increment3*NincPos3)
    NincPos3 = NincPos3 + 1
    Mode3 = 2
    ElsIf WinCountA3 >= WinCountB3 or StratAvgA3 >= StratAvgB3 and Mode3 = 1 Then
    TrailingStart = TrailingStart + (Increment3*PincPos3)
    PincPos3 = PincPos3 + 1
    Mode3 = 1
    ElsIf WinCountA3 < WinCountB3 and StratAvgA3 < StratAvgB3 and Mode3 = 2 Then
    TrailingStart = TrailingStart + (Increment3*PincPos3)
    PincPos3 = PincPos3 + 1
    Mode3 = 1
    ElsIf WinCountA3 >= WinCountB3 or StratAvgA3 >= StratAvgB3 and Mode3 = 2 Then
    TrailingStart = TrailingStart - (Increment3*NincPos3)
    NincPos3 = NincPos3 + 1
    Mode3 = 2
    EndIf
    
    If NincPos3 > MaxIncrement3 or PincPos3 > MaxIncrement3 Then
    If BestA3 = BestB3 Then
    TrailingStart = BestA3
    Else
    If Reps3 >= 10 Then
    WeightedScore3 = 10
    Else
    WeightedScore3 = round((Reps3/100)*100)
    EndIf
    TrailingStep = round(((BestA3*(20-WeightedScore3)) + (BestB3*WeightedScore3))/20) //Lower Reps3 = Less weight assigned to Win%
    EndIf
    NincPos3 = 1
    PincPos3 = 1
    ElsIf TrailingStart > MaxValue3 Then
    TrailingStart = MaxValue3
    ElsIf TrailingStart < MinValue3 Then
    TrailingStart = MinValue3
    EndIF
    
    optimize3 = 0
    EndIf
    // Heuristics Algorithm 3 End
    //************************************************************************
    // Heuristics Algorithm 4 Start
    If (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) Then
    optimize4 = optimize4 + 1
    EnDif
    
    StartingValue4 = 1.9
    ResetPeriod4 = 5 //Specify no of days after which to reset optimization
    Increment4 = 0.1
    MaxIncrement4 = 20 //Limit of no of Increment4s either up or down
    Reps4 = 3 //Number of trades to use for analysis
    MaxValue4 = 3 //Maximum allowed value
    MinValue4 = 1 //Minimum allowed value
    
    once Dayinit4 = Day
    once Monthinit4 = Month
    If (Month = Monthinit4 and Day = (Dayinit4 + ResetPeriod4)) or (Month = (Monthinit4 + 1) and ((month - Dayinit4) + Day = ResetPeriod4)) Then
    TrailingStep = StartingValue4
    WinCountB4 = 0
    StratAvgB4 = 0
    BestA4 = 0
    BestB4 = 0
    Dayinit4 = Day
    Monthinit4 = Month
    EndIf
    
    once TrailingStep = StartingValue4
    once PincPos4 = 1 //Positive Increment4 Position
    once NincPos4 = 1 //Neative Increment4 Position
    once optimize4 = 0 ////Initialize Heuristicks Engine Counter (Must be Increment4ed at Position Start or Exit)
    once Mode4 = 1 //Switches between negative and positive Increment4s
    //once WinCountB4 = 4 //Initialize Best Win Count
    //GRAPH WinCountB4 coloured (0,0,0) AS "WinCountB4"
    //once StratAvgB4 = 4454 //Initialize Best Avg Strategy Profit
    //GRAPH StratAvgB4 coloured (0,0,0) AS "StratAvgB4"
    
    If optimize4 = Reps4 Then
    WinCountA4 = 0 //Initialize current Win Count
    StratAvgA4 = 0 //Initialize current Avg Strategy Profit
    
    For i4 = 1 to Reps4 Do
    If positionperf(i4) > 0 Then
    WinCountA4 = WinCountA4 + 1 //Increment4 Current WinCount
    EndIf
    StratAvgA4 = StratAvgA4 + (((PositionPerf(i4)*countofposition[i4]*close)*-1)*-1)
    Next
    StratAvgA4 = StratAvgA4/Reps4 //Calculate Current Avg Strategy Profit
    //Graph (PositionPerf(1)*countofposition[1]*close)*-1 as "PosPerf1"
    //Graph (PositionPerf(2)*countofposition[2]*close)*-1 as "PosPerf2"
    //Graph StratAvgA4*-1 as "StratAvgA4"
    //once BestA4 = 400
    //GRAPH BestA4 coloured (0,0,0) AS "BestA4"
    If StratAvgA4 >= StratAvgB4 Then
    StratAvgB4 = StratAvgA4 //Update Best Strategy Profit
    BestA4 = TrailingStep
    EndIf
    //once BestB4 = 400
    //GRAPH BestB4 coloured (0,0,0) AS "BestB4"
    If WinCountA4 >= WinCountB4 Then
    WinCountB4 = WinCountA4  //Update Best Win Count
    BestB4 = TrailingStep
    EndIf
    
    If WinCountA4 > WinCountB4 and StratAvgA4 > StratAvgB4 Then
    Mode4 = 0
    ElsIf WinCountA4 < WinCountB4 and StratAvgA4 < StratAvgB4 and Mode4 = 1 Then
    TrailingStep = TrailingStep - (Increment4*NincPos4)
    NincPos4 = NincPos4 + 1
    Mode4 = 2
    ElsIf WinCountA4 >= WinCountB4 or StratAvgA4 >= StratAvgB4 and Mode4 = 1 Then
    TrailingStep = TrailingStep + (Increment4*PincPos4)
    PincPos4 = PincPos4 + 1
    Mode4 = 1
    ElsIf WinCountA4 < WinCountB4 and StratAvgA4 < StratAvgB4 and Mode4 = 2 Then
    TrailingStep = TrailingStep + (Increment4*PincPos4)
    PincPos4 = PincPos4 + 1
    Mode4 = 1
    ElsIf WinCountA4 >= WinCountB4 or StratAvgA4 >= StratAvgB4 and Mode4 = 2 Then
    TrailingStep = TrailingStep - (Increment4*NincPos4)
    NincPos4 = NincPos4 + 1
    Mode4 = 2
    EndIf
    
    If NincPos4 > MaxIncrement4 or PincPos4 > MaxIncrement4 Then
    If BestA4 = BestB4 Then
    TrailingStep = BestA4
    Else
    If Reps4 >= 10 Then
    WeightedScore4 = 10
    Else
    WeightedScore4 = round((Reps4/100)*100)
    EndIf
    TrailingStep = round(((BestA4*(20-WeightedScore4)) + (BestB4*WeightedScore4))/20) //Lower Reps4 = Less weight assigned to Win%
    EndIf
    NincPos4 = 1
    PincPos4 = 1
    ElsIf TrailingStep > MaxValue4 Then
    TrailingStep = MaxValue4
    ElsIf TrailingStep < MinValue4 Then
    TrailingStep = MinValue4
    EndIF
    
    optimize4 = 0
    EndIf
    // Heuristics Algorithm 4 End
    //************************************************************************
    //Pivot (H + L + C + O)/4
    If OpenDayOfWeek = 1 Then
    Ht = DHigh(2)
    Bs = DLow(2)
    C = DClose(2)
    O = DOpen(0)
    Endif
    If OpenDayOfWeek => 2 and dayofweek < 6 Then
    Ht = DHigh(1)
    Bs = DLow(1)
    C = DClose(1)
    O = DOpen(0)
    Endif
    
    Pivot = (Ht + Bs + C + O)/4
    Res4 = Ht + (3*(Pivot - BS))
    Res3 = Ht + (2*(Pivot - Bs))
    Res2 = Pivot + (Ht - Bs)
    Res1 = (2*Pivot) - Bs
    Sup1 = (2*Pivot) - Ht
    Sup2 = Pivot-(Ht - Bs)
    Sup3 = Bs - (2*(Ht - Pivot))
    Sup4 = Bs - (3*(Ht - Pivot))
    
    //Heikin-Hachi
    Once UpDown = 0
    IF BarIndex = 0 Then
    xClose = TotalPrice
    xOpen = Range
    xHigh = High
    xLow = Low
    Else
    xClose = TotalPrice
    xOpen = (xOpen[1] + xClose[1])/2
    xHigh = Max(max(high, xOpen), xClose)
    xLow = Min(min(Low, xOpen), xClose)
    endif
    If XClose >= XOpen then
    if UpDown <> 1 then
    UpDown = 1
    endif
    Else
    If UpDown <> -1 then
    UpDown = -1
    endif
    endif
    
    HHSize = 0.6
    Distance = 8
    LookBack = 8640
    SRk = 5
    SRs = 8
    //P = 9 // Slope, R², RSI, Sochastic
    //R2LimE = 0.52 // Coefficient de correlation R² d'entrée
    //R2LimS = 0.77 // Coefficient de correlation R² de sortie
    Q = P // Stochastic
    R = 3 // Stochastic
    S = 5 // Stochastic
    SumBull = 2 // Variable Bull
    SumBear = 2 // Variable Bear
    
    // Timeframe SRLevel
    timeframe (5 minutes, updateonclose)
    // --- icihmoku support and resistance
    kijun = (highest[26](high)+lowest[26](low))/2
    SSB = (highest[52](high[26])+lowest[52](low[26]))/2
     
    kijunp = summation[SRk](Kijun=Kijun[1])=SRk
    ssbp = summation[SRs](SSB=SSB[1])=SRs
     
    if kijunp then
    kijunPrice = kijun
    endif
    if ssbp then
    ssbPrice = SSB
    endif
    if kijunprice = ssbprice then
    SRlevel = kijunprice
    if SRLevel > Close then
    ResLevel = SRlevel
    elsif SRLevel < Close then
    SupLevel = SRlevel
    endif
    endif
    
    
    // Timeframe en UT Supérieur
    Timeframe (3 minutes, updateonclose)
    
    SlopeUTSup = Endpointaverage[P](LinearRegressionSlope[P](Close))
    If SlopeUTSup > SlopeUTSup[1] then
    BullUTSup = 1
    BearUTSup = 0
    Elsif SlopeUTSup < SlopeUTSup[1] then
    BullUTSup = 0
    BearUTSup = -1
    endif
    
    MyR2Sup = R2[P](Close)
    If MyR2Sup > R2LimE then
    AllowedEntry = 1
    Elsif MyR2Sup < R2LimE then
    AllowedEntry = 0
    Endif
    
    MyRSIUTSup = TriangularAverage[P](RSI[5](Close))
    If MyRSIUTSup > MyRSIUTSup[1] then
    MyRSIUTSupBull = +1
    MyRSIUTSupBear = 0
    Elsif MyRSIUTSup < MyRSIUTSup[1] then
    MyRSIUTSupBull = 0
    MyRSIUTSupBear = -1
    Endif
    //************************************************************************
    
    //Timeframe en UT de Trading
    Timeframe (10 seconds, default)
    
    EMA50 = ExponentialAverage[50](Close)
    EMA200 = ExponentialAverage[200](Close)
    
    Slope = EndpointAverage[P](LinearRegressionSlope[P](Close))
    If Slope > Slope[1] Then
    Bull = +1
    Bear = 0
    Elsif Slope < Slope[1] Then
    Bull = 0
    Bear = -1
    Endif
    
    MyR2 = R2[P](WeightedClose)
    MyRSI = EndpointAverage[P](RSI[5](Close))
    If MyRSI > MyRSI[1] then
    MyRSIBull = +1
    MyRSIBear = 0
    Elsif MyRSI < MyRSI[1] then
    MyRSIBull = 0
    MyRSIBear = -1
    Endif
    
    MyStocK = Stochastic[Q,R](close)
    MyStocD = WeightedAverage[S](Stochastic[Q,R](close))
    If MyStocK > MyStocD Then
    StocUp = +1
    StocDown = 0
    Elsif MyStocK < MyStocD Then
    StocUp = 0
    StocDown = -1
    Endif
    
    //************************************************************************
    levier = 2
    capital = 500 + (strategyprofit*2/5)
    z = (capital / (close/20)) * levier
    //************************************************************************
    //Position acheteuse
    BuyConditionA = (xClose - xOpen)*pipsize => HHSize
    BuyConditionB = Summation[SumBull](BullUTSup) = SumBull
    BuyConditionC = Summation[SumBull](AllowedEntry) = Sumbull
    BuyConditionD = MyRSIUTSup < 76.4
    BuyConditionE = summation[SumBull](MyRSIUTSupBull) = SumBull
    BuyConditionF = EMA50 > EMA200 and EMA50 < Close and EMA200 < Close
    BuyConditionG = Summation[SumBull](Bull) = SumBull
    BuyConditionH = MyRSI < 76.4
    BuyConditionI = summation[SumBull](MyRSIBull) = SumBull
    BuyConditionJ = Summation[SumBull](StocUp) = SumBull and MyStocK < 80
    BuyConditionK = MyR2 Crosses over R2LimE
    BuyConditionL = MyR2 > R2LimE
    if BuyconditionA and BuyConditionB and BuyConditionC and BuyConditionD and BuyConditionE and BuyConditionF and BuyConditionG and BuyConditionH and BuyConditionI and BuyConditionJ and BuyConditionK and not onmarket and not daysForbiddenEntry then
    allowtrading = 1
    for iSRB = 0 to lookback -1 do
    dist = (Reslevel[iSRB] - Close) < distance*pipsize
    if dist then
    allowtrading = 0 //no trading is allowed we are near a SR!
    break //break the loop, no need to continue, trading is not allowed anymore!
    endif
    next
    if close > pivot then
    //above Pivot
    iPivt = 1
    while iPivt =< 4 do
    if iPivt = 1 then
    Floor = Pivot
    Ceil = Res1
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 2 then
    Floor = Res1
    Ceil = Res2
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 3 then
    Floor = Res2
    Ceil = Res3
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 4 then
    Floor = Res3
    Ceil = Res4
    if close > Floor and close < Ceil then
    break
    endif
    endif
    iPivt = iPivt + 1
    wend
    elsif close < Pivot then
    //below Pivot
    iPivt = 1
    while iPivt <= 4 do
    if iPivt = 1 then
    Floor = Sup1
    Ceil = Pivot
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 2 then
    Floor = Sup2
    Ceil = Sup1
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 3 then
    Floor = Sup3
    Ceil = Sup2
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 4 then
    Floor = Sup4
    Ceil = Sup3
    if close > Floor and close < Ceil then
    break
    endif
    endif
    iPivt = iPivt + 1
    wend
    endif
    For IPivt = 1 to 4 do
    dist = (Ceil - Close) < distance*pipsize
    If Dist then
    allowtrading = 0
    Break
    endif
    next
    If BuyConditionL then
    Entry = Barindex
    endif
    if Barindex-Entry <= 2 then
    if allowtrading then
    buy z share at market
    endif
    endif
    endif
    
    If Longonmarket and MyR2Sup crosses under R2LimS then
    Sell at Market
    elsif Longonmarket and MyR2Sup crosses under R2LimE then
    Sell at Market
    Endif
    
    //Position Vendeuse
    SellConditionA = (xOpen - xClose)*pipsize => HHSize
    SellConditionB = Summation[SumBear](BearUTSup) = -SumBear
    SellConditionC = Summation[SumBull](AllowedEntry) = SumBull
    SellConditionD = MyRSIUTSup > 23.6
    SellConditionE = Summation[SumBear](MyRSIUTSupBear) = -SumBear
    SellConditionF = EMA50 < EMA200 and EMA50 > Close and EMA200 > Close
    SellConditionG = Summation[SumBear](Bear) = -SumBear
    SellConditionH = MyRSI > 23.6
    SellConditionI = Summation[SumBear](MyRSIBear) = -SumBear
    SellConditionJ = Summation[SumBear](StocDown) = -SumBear and MyStocK > 20
    SellConditionK = MyR2 Crosses over R2LimE
    SellConditionL = MyR2 > R2LimE
    if SellConditionA and SellconditionB and SellConditionC And SellConditionD and SellConditionE and SellConditionF and SellConditionG and SellConditionH and SellConditionI and SellConditionJ and SellConditionK and not onmarket and not daysForbiddenEntry then
    allowtrading = 1
    for iSRV = 0 to lookback -1 do
    dist = (close-Suplevel[iSRV]) < distance*pipsize
    if dist then
    allowtrading = 0 //no trading is allowed we are near a SR!
    break //break the loop, no need to continue, trading is not allowed anymore!
    endif
    next
    if close > pivot then
    //above Pivot
    iPivt = 1
    while iPivt =< 4 do
    if iPivt = 1 then
    Floor = Pivot
    Ceil = Res1
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 2 then
    Floor = Res1
    Ceil = Res2
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 3 then
    Floor = Res2
    Ceil = Res3
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 4 then
    Floor = Res3
    Ceil = Res4
    if close > Floor and close < Ceil then
    break
    endif
    endif
    iPivt = iPivt + 1
    wend
    elsif close < Pivot then
    //below Pivot
    iPivt = 1
    while iPivt <= 4 do
    if iPivt = 1 then
    Floor = Sup1
    Ceil = Pivot
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 2 then
    Floor = Sup2
    Ceil = Sup1
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 3 then
    Floor = Sup3
    Ceil = Sup2
    if close > Floor and close < Ceil then
    break
    endif
    elsif iPivt = 4 then
    Floor = Sup4
    Ceil = Sup3
    if close > Floor and close < Ceil then
    break
    endif
    endif
    iPivt = iPivt + 1
    wend
    endif
    For IPivt = 1 to 4 do
    dist = (Close - Floor) < distance*pipsize
    If Dist then
    allowtrading = 0
    Break
    endif
    next
    if SellConditionL then
    Entry = Barindex
    endif
    If Barindex-Entry <= 2 then
    if allowtrading then
    sellshort z share at market
    endif
    endif
    endif
    
    If Shortonmarket and MyR2Sup crosses under R2LimS then
    Exitshort at market
    elsif Shortonmarket and MyR2Sup crosses under R2LimE then
    Exitshort at market
    Endif
    
    //************************************************************************
    //Stop Loss & Trailing function
    //Set stop $loss capital*levier*4/100
    Set Target $Profit capital*levier*3/100
    
    //reset the stoploss value
    If not onmarket then
    newSL = 0
    Endif
    
    //manage long positions
    If Longonmarket Then
    If newSL = 0 and xLow-tradeprice(1) > trailingstart*pipsize then
    newSL = tradeprice(1) + trailingstep*pipsize
    Endif
    If newSL <> 0 and xLow-newSL > trailingstep*pipsize then
    newSL = newSL + trailingstep*pipsize
    Endif
    Endif
    
    //manage short positions
    If ShortonMarket then
    If newSL = 0 and tradeprice(1)-xHigh > trailingstart*pipsize Then
    newSL = tradeprice(1) - trailingstep*pipsize
    Endif
    If newSL <> 0 and newSL-xHigh > trailingstep*pipsize Then
    newSL = newSL - trailingstep*pipsize
    Endif
    Endif
    
    //stop order to exit the positions
    If newSL <> 0 Then
    Sell at newSL Stop
    Exitshort at newSL Stop
    Endif
    //************************************************************************
    

    ma contribution au cercle vertueux…

    Nicolas thanked this post
    IA-NASDAQ-R²-V1.062HiSR.itf
    #149917 quote
    Nicolas
    Keymaster
    Master

    Merci Fantasio, pourrais-tu nous en dire un peu plus sur la stratégie ? Le code étant très long et complexe, ce serait déjà une bonne base pour les suggestions d’améliorations ! Merci encore 😉

    #149926 quote
    Fantasio2020
    Participant
    Senior
    Slt Nicolas, oui en effet, le code est long mais il ne doit pas faire peur…! tout d’abord, je dois dire que j’ai découvert prorealcode pendant le dernier confinement, je ne suis pas programmeur, j’apprend sur le tas en lisant le forum et en décryptant vos codes à tous; beaucoup dans mon code sont des morceaux qui viennent d’un peu partout, j’ai peut être des incohérences ce qui expliquerait que je me retrouve certaines semaines avec des résultats neutre, d’autres semaines c’est très bon. c’est une stratégie  disont “intrascalp” qui prend en compte plusieurs timeframe, car c’est le seul moyen fiable que j’ai trouvé pour confirmer la tendance à court terme. c’est une stratégie en 10 secondes ce qui ne me permet pas de backtester au delà de 4 jours, peut être certain d’entre vous pouront faire plus avec la V11 la première partie du code sont une succession de 5 algorithmes que j’ai emprunté à Juan. ils servent à l’optimisation des variables:
    • StartingValueP = période pour:
      • Slope ==> pente de régression linéaire
      • R² ==> coefficient de corrélation de Scope
      • moyenne mobile d’un RSI[5]
      • période du Stochastique
    • StartingValue = variable d’ajustement pour la valeur d’entrée en position en fonction du R² ( supérieur à 0,4) 0.54
    • StartingValue2 = variable d’ajustement du R² de sortie
    • StartingValue3 = il s’agit de l’optimisation de la variable d’un trailingstart (basée sur Heikin Ashi)
    • StartingValue4 = il s’agit de l’optimisation de la variable d’un trailingstep (basée sur Heikin Ashi)
    En Effet j’utilise un xClose et xOpen en lieu et place de Close, car j’ai remarqué que j’obtenais de meilleurs résultats de cette manière (Nicolas il s’agit de ton code  que j’ai adapté à mes besoins) j’utilise donc plusieur timeframe
    • Timeframe (5 minutes, updateonclose)

    j’utilise Ichimoku dans ce timeframe pour definir des supports et résistance en fonction des plats Kijun et SSB, j’utilise également le point pivot pour définir les résistance et support du pivot, si je suis trop proche de ces zones je ne dois pas trader!

    • Timeframe (3 minutes, updateonclose) ça change en fonction de l’actif, car ce time frame est important pour l’indice trader, 2, 3, 4….4 étant un maximum
      • dans ce time frame intervient plusieurs indicateurs:
        • une pente de régression linéaire (Slope)
        • un R²
        • un RSI

    Slope me donne la tendance, elle monte je suis à l’achat, elle descend je suis à la vente. le RSI doit être inférieur à 76.4 en achat et supérieur à 23.8 en vente (référence à un palier de fibo…;)); le R² me sert pour déterminer un point d’entrée, en fonction de Slope, il me confirme la tendance lorsqu’il est supérieur à 0,x  “0.54 dans le cas présent sur le Nasdaq). c’est tout pour ce time frame.

    j’ai créer des valeurs booléenne pour l’interprétation de comment le code doit fonctionner (si des questions je suis à votre disposition)

    • Timeframe (10 seconds, default)
      • c’est le timeframe de trading, si les conditions définies dans le timeframe supérieur (3 minutes) sont remplie, et que je trouve un point d’entrée en 10 sec alors j’entre.
      • je remarque malgré tout que souvent après etre entré en position le marché se retourne, il s’agit de la seule raison qui me fait perdre une position (j’en arrive à la conclusion que je suis chaque fois en retard sur l’entrée)

    Dans ce timeframe j’utilise également:

      • deux moyennes mobile 50 et 200 (filtre pour entrer en position, sous les moyenne ==> vente ; au dessus des moyenne ==> Achat)
      • une pente de régression linéaire
      • une R²
      • un RSI et un Stochastique

    pour entrer en position, le RSI doit remplir les même condition qu’en UT supérieur, idem Slope et R² et le stochastique > 20 en vente et <80 à l’achat.

      • que ce soit à la vente ou à l’achat, la différence entre l’ouverture et la fermeture de la bougie précédente ne doit pas être inférieur à 0.6*pipsize
      • voir les conditions
    pour sortir de position, il y a deux solution:
    1. soit le stop suivre se déclenche et la position est gagnée quoi qu’il arrive
    2. soit le stop suiveur ne se déclenche pas et le marché se retourne et alors c’est le croisement à la baisse du R² en ut supérieur qui sert de stoploss
      1. R2limS qui correspond à une valeur élevée du R² (0.7 par défaut)
      2. R2LimE qui correspond à la valeur de corrélation limite
    voila c’est pas compliqué ;=), j’espère être clair.
    #150002 quote
    Nicolas
    Keymaster
    Master
    En effet c’est beaucoup plus clair, merci pour ce résumé 🙂 AMHA, il y a trop de conditions liées à des calculs d’indicateurs dans ton timeframe 10-sec. Si tu connais ta tendance dans les timeframes supérieurs, tu devrais attendre un retour à la moyenne dans ceux-ci, et trouver une action simple du prix dans la plus petite des unités de temps pour lancer ta position.
    #150005 quote
    Fantasio2020
    Participant
    Senior
    Slt Nicolas, je vais essayé de pondre un truc… j’ai tellement passé de temps sur ce put….. de code que j’avoue avoir envie de prendre un peu de distance quelques jours. merci pour ton retour en tout cas. à titre personnel, vu que tu es le nez dans le code plus que moi, que pense tu de la stratégie?
    #150261 quote
    Fantasio2020
    Participant
    Senior
    En effet c’est beaucoup plus clair, merci pour ce résumé 🙂 AMHA, il y a trop de conditions liées à des calculs d’indicateurs dans ton timeframe 10-sec. Si tu connais ta tendance dans les timeframes supérieurs, tu devrais attendre un retour à la moyenne dans ceux-ci, et trouver une action simple du prix dans la plus petite des unités de temps pour lancer ta position.
    Slt Nicolas, j’ai tenté de réduire les conditions en UT 10′ sans réel amélioration. j’ai ajusté et filtré mon code actuel ce qui améliore la stratégie, mais je suis convaincu qu’il y a moyen d’obtenir mieux… le code actuel fonctionne bien sur le nasdaq….sur les autres indices c’estplus compliqué.
    strategie-10-secondes.txt
    #150308 quote
    Fantasio2020
    Participant
    Senior
    Dernière mise à jour: [edit modérateur: merci de poster la stratégie en fichier texte attaché, trop de codes à afficher] …
    #150310 quote
    Nicolas
    Keymaster
    Master
    Merci Fantasio, mais j’ai dut supprimer le dernier code, ça faisait planter l’affichage du site 🙄 Aurais-tu la gentillesse d’attacher le code dans un fichier texte la prochaine fois ? (on un ficher itf bien entendu). Merci encore pour le partage.
    #150312 quote
    Fantasio2020
    Participant
    Senior
    #150318 quote
    Fantasio2020
    Participant
    Senior
    Merci Fantasio, mais j’ai dut supprimer le dernier code, ça faisait planter l’affichage du site 🙄 Aurais-tu la gentillesse d’attacher le code dans un fichier texte la prochaine fois ? (on un ficher itf bien entendu). Merci encore pour le partage.
    Disons que j’espère aussi profiter des amélioration que d’autre pourrons apporter. jusque là j’ai beaucoup sollicité la communauté, à mon tour de proposer quelque chose. si la stratégie s’avère pas trop mal je pourrais l’ajouter à la base de donnée des stratégies déjà existantes.
    #150327 quote
    Fantasio2020
    Participant
    Senior
    Petite erreur sur les conditions de sortie de short:
    If Shortonmarket and EMA13 crosses over EMA50 then
    Exitshort at Market
    elsif shortonmarket and MyR2Sup crosses under R2LimS then
    Exitshort at Market
    elsif shortonmarket and MyR2Sup crosses under R2LimE then
    Exitshort at Market
    Endif
    erreur de copié collé.
    #150774 quote
    Khaled
    Participant
    Veteran
    Bonjour Fantasio, Merci d’avoir partagé ton travail. Je ne suis pas Expert, mais ton code m’intéresse beaucoup car vue la volatilité actuelle, il vaut mieux profiter de micro oscillations que de faire du Trend Following. Il suffit d’un Tweet de X ou Y personnalité pour que le compte parte en fumée 🙂 J’ai repris ton fichier (IA-NASDAQ-R²-V1.063HiSR.itf) et j’ai mis à jour les conditions de sortie comme indiqué dans ton post (#150327). Malheureusement, j’arrive à un résultat largement inférieur à ton screen shot tant sur le Win Rate (60%) que sur le Profit Factor (x1.05). Aussi, l’Algo n’a pris que des ordres Short. As-tu fais les tests en mode tick by tick? Le Spread de 1 ne correspond pas à ce qu’il y a sur le site de IG. Sur des allers-retours fréquents avec petits gains, cela peut avoir un gros impact sur le résultat final. Je serais intéressé de savoir si tu obtiens les mêmes résultats.
    ///   SPREAD NQ  //////
    IF time>=133000 AND time>200000 then
    spread = 1/2
    ELSIF time>=200000 AND time>220000 then
    spread = 5/2
    ELSIF time>=220000 AND time>133000 then
    spread = 2/2
    ENDIF
      Si tu postes la dernière version, je peux faire des tests sur SP500 et DAX si cela t’intéresse.
    IA-NASDAQ-2020-11-17-122245.png IA-NASDAQ-2020-11-17-122245.png IA-NASDAQ-2-2020-11-17-122245.png IA-NASDAQ-2-2020-11-17-122245.png IA-NASDAQ-3-2020-11-17-122245.png IA-NASDAQ-3-2020-11-17-122245.png IA-NASDAQ-4-2020-11-17-122245.png IA-NASDAQ-4-2020-11-17-122245.png
    #150784 quote
    Fantasio2020
    Participant
    Senior
    Slt Khaled, oui j’obtiens plus ou moins les mêmes résultats. les les backtest sont toujours effectués en tick/tick Je constat néanmoins des divergences entre back test et réel…. souvent en réel les résultats sont moins bon. La stratégie tourne pour le moment en demo, et j’observe… quand je détecte des position perdante j’essaie de compenser en ajoutant un filtre, c’est la raison pour laquelle le code s’allonge de semaine en semaine… et j’atteins les limites avec le code ci-joint; raison pour laquelle j’ai partagé…afin que la communauté puisse apporter sa contribution. La stratégie est bonne, je l’utilise quotidiennement en manuel avec de bon résultats ( 4 à 5%/jours avec une bonne discipline) le problème, c’est que c’est très difficile de demander à une statégie automatique de remplacer l’œil humain. Par contre l’histoire du spread, j’ai déjà effectué beaucoup de test sur différentes plages de trading, mais en dehors des plages horaires des marchés US ou EUR, je n’ai pas de bon résultats, car ils se comportent différemment en dehors des ouvertures de marché respective. Bien que les plages d’IG  soient différentes et côtent H24, je ne conseil pas de trader les marchés US et dehors des ouvertures de WS (15H30 – 22H00 heures Europe) idem pour le CAC ou le DAX qui se trade entre 9h et 17h30 au plus tard; avec cette stratégie.
    Sans-titre-3.png Sans-titre-3.png
    #150788 quote
    Khaled
    Participant
    Veteran
    Fantasio, je suis d’accord sur les horaires de trading sur IG, après la clôture des marchés US, ça devient du rodéo… ça doit être des Algos… Est ce que tu sais pourquoi ton Algo ne sort que des Trade Short ? même après la correction de SELL en SELLSHORT?
    #150789 quote
    Fantasio2020
    Participant
    Senior
    ça doit être un concours de circonstance, car sur des backtest des précédentes semaine j’ai eu des long…. j’ai également eu un long il y a une quinzaine de minute sur un autre indice
Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.

Stratégie multi indices en 10′ (secondes)


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 21 replies,
has 4 voices, and was last updated by Meta Signals Pro
2 years, 6 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 11/09/2020
Status: Active
Attachments: 10 files
Logo Logo
Loading...