Turtle soup snail trading stratégie pour ProRealTime

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #260126 quote
    Paul Frédéric
    Participant
    Junior

    a

    #260129 quote
    robertogozzi
    Moderator
    Master

    Aviez-vous l’intention d’écrire quelque chose ou s’agissait-il d’une erreur ?


    #260134 quote
    Paul Frédéric
    Participant
    Junior

    Deux secondes please. Snail

    #260135 quote
    Paul Frédéric
    Participant
    Junior

    TurtlesoupSNAIL

    #260136 quote
    Paul Frédéric
    Participant
    Junior

    The code

    #260138 quote
    GraHal
    Participant
    Master
    // Turtle Soup Strategy - ProOrder
    DEFPARAM CumulateOrders = False
    
    
    // --- Parameters ---
    Lookback = 20        // 20-period range
    MinDist = 4          // Previous extreme must be at least 4 bars ago
    Offset = 5 * pipsize // Entry buffer above/below extreme
    
    
    // --- Define 20-period high and low (excluding current bar) ---
    Low20 = Lowest[Lookback](low)[1]
    High20 = Highest[Lookback](high)[1]
    
    
    // --- Identify the previous extreme's position ---
    BarOfLow = LowestBars[Lookback](low)[1]
    BarOfHigh = HighestBars[Lookback](high)[1]
    
    
    // --- Conditions ---
    // Bullish: New low today, but previous 20-period low was > 4 bars ago
    BullishSetup = (low < Low20) AND (BarOfLow >= MinDist)
    // Bearish: New high today, but previous 20-period high was > 4 bars ago
    BearishSetup = (high > High20) AND (BarOfHigh >= MinDist)
    
    
    // --- Entry Logic (Fade the breakout) ---
    IF BullishSetup THEN
        BUY 1 CONTRACT AT Low20 + Offset STOP
    ENDIF
    
    
    IF BearishSetup THEN
        SELLSHORT 1 CONTRACT AT High20 - Offset STOP
    ENDIF
    
    
    // --- Simple Exit (Exit on target or after X bars) ---
    SET TARGET pPROFIT 50
    SET STOP pLOSS 25
    
    
    
    robertogozzi thanked this post
    #260139 quote
    GraHal
    Participant
    Master

    Voici également le document de présélection


    // Turtle Soup Screener
    Lookback = 20
    MinDist = 4
    
    
    // Get 20-period extremes from previous bars
    Low20 = Lowest[Lookback](low)[1]
    High20 = Highest[Lookback](high)[1]
    
    
    // Find when those extremes occurred
    BarOfLow = LowestBars[Lookback](low)[1]
    BarOfHigh = HighestBars[Lookback](high)[1]
    
    
    // Detect the false breakout (price currently below/above but reversing)
    BullishSoup = (low < Low20) AND (close > Low20) AND (BarOfLow >= MinDist)
    BearishSoup = (high > High20) AND (close < High20) AND (BarOfHigh >= MinDist)
    
    
    // Sorting criteria (1 for Buy, -1 for Sell)
    IF BullishSoup THEN
        Signal = 1
    ELSIF BearishSoup THEN
        Signal = -1
    ELSE
        Signal = 0
    ENDIF
    
    
    SCREENER[Signal <> 0] (Signal AS "1=Buy -1=Sell")
    
    
    


    #260167 quote
    Paul Frédéric
    Participant
    Junior

    Turtle Soup 1s — 10 Itérations complètes

    Codes PRT prêts à compiler — Option C trailing stop intégrée

    Tableau récapitulatif

    Vert = R/R ≥ 2.3 | Jaune = R/R ≥ 1.9 | Rouge = R/R < 1.9

    #

    Profil

    Donchian

    RSI L/H

    Stop

    Target

    Trail

    R/R

    1

    Scalp agressif

    20

    32 / 68

    0.8

    1.5

    0.4

    1.88

    2

    Équilibré court

    25

    30 / 70

    1.0

    2.0

    0.5

    2.00

    3

    Référence v1.0

    30

    32 / 68

    1.2

    2.0

    0.6

    1.67

    4

    Filtres stricts

    30

    28 / 72

    1.2

    2.5

    0.6

    2.08

    5

    Momentum moyen

    35

    30 / 70

    1.4

    2.5

    0.6

    1.79

    6

    Target étendu

    35

    32 / 68

    1.2

    3.0

    0.7

    2.50

    7

    Swing court

    40

    30 / 70

    1.4

    2.8

    0.7

    2.00

    8

    Trend-following

    40

    28 / 72

    1.6

    3.0

    0.8

    1.88

    9

    Intermédiaire

    45

    30 / 70

    1.4

    2.5

    0.7

    1.79

    10

    Conservateur

    50

    28 / 72

    1.6

    3.0

    0.8

    1.88

    Itération 1 — Scalp agressif

    Donchian : 20 | RSI : 32/68 | Stop : 0.8× ATR | Target : 1.5× ATR | Trailing : 0.4× ATR | R/R théo. : 1.88

    // === TURTLE SOUP 1S – ITERATION 1 : SCALP AGRESSIF ===

    // R/R théorique : 1.88 | Donchian:20 RSI:32/68 Stop:0.8 Target:1.5 Trail:0.4

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 20

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 0.8

    ATR_Target = 1.5

    TrailingRetrace = 0.4

    RSI_Long = 32

    RSI_Short = 68

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 2 — Équilibré court

    Donchian : 25 | RSI : 30/70 | Stop : 1.0× ATR | Target : 2.0× ATR | Trailing : 0.5× ATR | R/R théo. : 2.00

    // === TURTLE SOUP 1S – ITERATION 2 : ÉQUILIBRÉ COURT ===

    // R/R théorique : 2.00 | Donchian:25 RSI:30/70 Stop:1 Target:2 Trail:0.5

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 25

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.0

    ATR_Target = 2.0

    TrailingRetrace = 0.5

    RSI_Long = 30

    RSI_Short = 70

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 3 — Référence v1.0

    Donchian : 30 | RSI : 32/68 | Stop : 1.2× ATR | Target : 2.0× ATR | Trailing : 0.6× ATR | R/R théo. : 1.67

    // === TURTLE SOUP 1S – ITERATION 3 : RÉFÉRENCE V1.0 ===

    // R/R théorique : 1.67 | Donchian:30 RSI:32/68 Stop:1.2 Target:2 Trail:0.6

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 30

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.2

    ATR_Target = 2.0

    TrailingRetrace = 0.6

    RSI_Long = 32

    RSI_Short = 68

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 4 — Filtres stricts

    Donchian : 30 | RSI : 28/72 | Stop : 1.2× ATR | Target : 2.5× ATR | Trailing : 0.6× ATR | R/R théo. : 2.08

    // === TURTLE SOUP 1S – ITERATION 4 : FILTRES STRICTS ===

    // R/R théorique : 2.08 | Donchian:30 RSI:28/72 Stop:1.2 Target:2.5 Trail:0.6

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 30

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.2

    ATR_Target = 2.5

    TrailingRetrace = 0.6

    RSI_Long = 28

    RSI_Short = 72

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 5 — Momentum moyen

    Donchian : 35 | RSI : 30/70 | Stop : 1.4× ATR | Target : 2.5× ATR | Trailing : 0.6× ATR | R/R théo. : 1.79

    // === TURTLE SOUP 1S – ITERATION 5 : MOMENTUM MOYEN ===

    // R/R théorique : 1.79 | Donchian:35 RSI:30/70 Stop:1.4 Target:2.5 Trail:0.6

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 35

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.4

    ATR_Target = 2.5

    TrailingRetrace = 0.6

    RSI_Long = 30

    RSI_Short = 70

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 6 — Target étendu

    Donchian : 35 | RSI : 32/68 | Stop : 1.2× ATR | Target : 3.0× ATR | Trailing : 0.7× ATR | R/R théo. : 2.50

    // === TURTLE SOUP 1S – ITERATION 6 : TARGET ÉTENDU ===

    // R/R théorique : 2.50 | Donchian:35 RSI:32/68 Stop:1.2 Target:3 Trail:0.7

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 35

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.2

    ATR_Target = 3.0

    TrailingRetrace = 0.7

    RSI_Long = 32

    RSI_Short = 68

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 7 — Swing court

    Donchian : 40 | RSI : 30/70 | Stop : 1.4× ATR | Target : 2.8× ATR | Trailing : 0.7× ATR | R/R théo. : 2.00

    // === TURTLE SOUP 1S – ITERATION 7 : SWING COURT ===

    // R/R théorique : 2.00 | Donchian:40 RSI:30/70 Stop:1.4 Target:2.8 Trail:0.7

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 40

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.4

    ATR_Target = 2.8

    TrailingRetrace = 0.7

    RSI_Long = 30

    RSI_Short = 70

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 8 — Trend-following

    Donchian : 40 | RSI : 28/72 | Stop : 1.6× ATR | Target : 3.0× ATR | Trailing : 0.8× ATR | R/R théo. : 1.88

    // === TURTLE SOUP 1S – ITERATION 8 : TREND-FOLLOWING ===

    // R/R théorique : 1.88 | Donchian:40 RSI:28/72 Stop:1.6 Target:3 Trail:0.8

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 40

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.6

    ATR_Target = 3.0

    TrailingRetrace = 0.8

    RSI_Long = 28

    RSI_Short = 72

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 9 — Intermédiaire

    Donchian : 45 | RSI : 30/70 | Stop : 1.4× ATR | Target : 2.5× ATR | Trailing : 0.7× ATR | R/R théo. : 1.79

    // === TURTLE SOUP 1S – ITERATION 9 : INTERMÉDIAIRE ===

    // R/R théorique : 1.79 | Donchian:45 RSI:30/70 Stop:1.4 Target:2.5 Trail:0.7

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 45

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.4

    ATR_Target = 2.5

    TrailingRetrace = 0.7

    RSI_Long = 30

    RSI_Short = 70

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    Itération 10 — Conservateur

    Donchian : 50 | RSI : 28/72 | Stop : 1.6× ATR | Target : 3.0× ATR | Trailing : 0.8× ATR | R/R théo. : 1.88

    // === TURTLE SOUP 1S – ITERATION 10 : CONSERVATEUR ===

    // R/R théorique : 1.88 | Donchian:50 RSI:28/72 Stop:1.6 Target:3 Trail:0.8

    DEFPARAM CumulateOrders = False

    // === PARAMÈTRES ===

    LookbackDonchian = 50

    RSI_Period = 8

    ATR_Period = 14

    MinVolMult = 1.2

    ATR_Stop = 1.6

    ATR_Target = 3.0

    TrailingRetrace = 0.8

    RSI_Long = 28

    RSI_Short = 72

    // === CALCULS ===

    PrevDonchHigh = Highest[LookbackDonchian](High)[1]

    PrevDonchLow = Lowest[LookbackDonchian](Low)[1]

    MyATR = ATR[ATR_Period](Close)

    MyRSI = RSI[RSI_Period](Close)

    VolAvg = Average[30](Volume)

    EMA5 = ExponentialAverage[5](Close)

    EMA20 = ExponentialAverage[20](Close)

    StopDist = MyATR * ATR_Stop

    TargetDist = MyATR * ATR_Target

    // === CONDITIONS ===

    CondLong1 = Close < PrevDonchLow AND MyRSI < RSI_Long

    CondLong2 = Volume > VolAvg * MinVolMult AND EMA5 > EMA20[3]

    CondLong = CondLong1 AND CondLong2

    CondShort1 = Close > PrevDonchHigh AND MyRSI > RSI_Short

    CondShort2 = Volume > VolAvg * MinVolMult AND EMA5 < EMA20[3]

    CondShort = CondShort1 AND CondShort2

    // === ENTRÉES ===

    IF CondLong AND NOT LongOnMarket THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    IF CondShort AND NOT ShortOnMarket THEN

    SELLSHORT 1 CONTRACT AT MARKET

    ENDIF

    // === SORTIES LONG (Trailing Option C) ===

    IF LongOnMarket THEN

    ProfitL = Close – PositionAveragePrice

    MaxProfitL = MAX(ProfitL, MaxProfitL[1])

    IF ProfitL >= TargetDist THEN

    SELL AT MARKET

    ELSIF MaxProfitL >= MyATR AND ProfitL < MaxProfitL – MyATR * TrailingRetrace THEN

    SELL AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF

    // === SORTIES SHORT (Trailing Option C) ===

    IF ShortOnMarket THEN

    ProfitS = PositionAveragePrice – Close

    MaxProfitS = MAX(ProfitS, MaxProfitS[1])

    IF ProfitS >= TargetDist THEN

    EXITSHORT AT MARKET

    ELSIF MaxProfitS >= MyATR AND ProfitS < MaxProfitS – MyATR * TrailingRetrace THEN

    EXITSHORT AT MARKET

    ENDIF

    SET STOP LOSS StopDist

    ENDIF


    #260175 quote
    Nicolas
    Keymaster
    Master

    Bonjour Paul,

    Malheureusement, tous ces codes générés par IA comportent des erreurs. Pourriez vous svp nous indiquer ce que vous souhaiteriez obtenir svp ?

    #260176 quote
    Paul Frédéric
    Participant
    Junior

    je comprends,

    ce que je cherche c’est:

    1 adapter mon code pour scalper audusd et eurusd

    et surtout qu’il passe mes ordres……..

    2 et utiliser le parabolique pour mes stop suiveurs en fonction de l’ATR





    #260181 quote
    Nicolas
    Keymaster
    Master

    Sans trop de détails sur ce que doit faire la stratégie, voici une proposition d’une stratégie TurtleSoup (trading sur les faux breakout) avec un trailing stop basé sur le parabolic SAR:

    // ============================================================
    // TURTLE SOUP SCALPER FOREX — Trailing Stop Parabolic SAR
    // Principe : exploiter le faux breakout du canal de Donchian
    // Timeframe recommandé : M5 ou M15, paires majeures Forex
    // ============================================================
    
    DEFPARAM CumulateOrders = False
    
    // --- Paramètres utilisateur (optimisables) ---
    lookback    = 20    // Période du canal Donchian pour détecter le breakout
    sarAF       = 0.02  // Facteur d'accélération initial du Parabolic SAR
    sarStep     = 0.02  // Incrément du facteur d'accélération
    sarMax      = 0.2   // Plafond du facteur d'accélération
    atrPeriod   = 14    // Période ATR pour calibrer les stops et le TP
    riskMult    = 1.5   // Stop initial = riskMult x ATR depuis le prix d'entrée
    tpMult      = 2.0   // Take profit = tpMult x ATR depuis le prix d'entrée
    confirmBars = 2     // Bougies en arrière pour valider le faux breakout
    
    // --- Canal de Donchian (excluant la bougie courante) ---
    chanHigh = Highest[lookback](high[1])
    chanLow  = Lowest[lookback](low[1])
    
    // --- Indicateurs ---
    mySAR = SAR[sarAF, sarStep, sarMax]
    myATR = AverageTrueRange[atrPeriod](close)
    
    // --- Détection du Turtle Soup ---
    // Long : cassure sous chanLow il y a confirmBars bougies, puis retour haussier
    falseBreakDn = low[confirmBars] <= chanLow AND close > chanLow AND close > open
    // Short : cassure au-dessus de chanHigh il y a confirmBars bougies, puis retour baissier
    falseBreakUp = high[confirmBars] >= chanHigh AND close < chanHigh AND close < open
    
    // --- Filtre SAR comme confirmation de direction ---
    // On n'entre long que si le SAR est déjà sous le cours (SAR haussier)
    // On n'entre short que si le SAR est déjà au-dessus du cours (SAR baissier)
    sarLongOK  = mySAR < close
    sarShortOK = mySAR > close
    
    // -----------------------------------------------
    // ENTREES
    // -----------------------------------------------
    IF NOT LongOnMarket AND NOT ShortOnMarket THEN
       IF falseBreakDn AND sarLongOK THEN
          BUY 1 CONTRACT AT MARKET
       ENDIF
       IF falseBreakUp AND sarShortOK THEN
          SELLSHORT 1 CONTRACT AT MARKET
       ENDIF
    ENDIF
    
    // -----------------------------------------------
    // SORTIES DYNAMIQUES PAR PARABOLIC SAR
    // Dès que le SAR retourne contre la position, on sort
    // C'est le coeur du trailing stop basé sur le SAR
    // -----------------------------------------------
    IF LongOnMarket AND mySAR > close THEN
       SELL AT MARKET
    ENDIF
    
    IF ShortOnMarket AND mySAR < close THEN
       EXITSHORT AT MARKET
    ENDIF
    
    // -----------------------------------------------
    // STOP INITIAL DE SECURITE + TAKE PROFIT (en ATR)
    // Garde-fou en cas de gap ou de volatilité extrême
    // Ces niveaux sont fixes dès l'entrée en position
    // -----------------------------------------------
    IF LongOnMarket THEN
       SET STOP LOSS (tradeprice - riskMult * myATR)
       SET TARGET PROFIT (tradeprice + tpMult * myATR)
    ENDIF
    
    IF ShortOnMarket THEN
       SET STOP LOSS (tradeprice + riskMult * myATR)
       SET TARGET PROFIT (tradeprice - tpMult * myATR)
    ENDIF
    

    Voici comment fonctionne la logique complète :

    Principe Turtle Soup :

    • Le Turtle Soup est la stratégie inverse des Turtles classiques. Là où les Turtles achetaient un breakout sur 20 bougies, le Turtle Soup parie sur l’échec de ce breakout. Si le prix casse sous le plus bas des 20 dernières bougies mais referme au-dessus avec une bougie haussière, c’est un signal long (et inversement pour le short).

    Filtre Parabolic SAR à l’entrée :

    • Le SAR doit déjà être du bon côté du prix au moment de l’entrée. Cela évite d’entrer à contresens d’une tendance forte.

    Trailing stop SAR à la sortie :

    • C’est la pièce centrale. Tant que le SAR reste sous le prix en long (ou au-dessus en short), la position reste ouverte. Dès que le SAR passe de l’autre côté, la position est clôturée au marché. Le SAR accélère naturellement en fin de tendance, ce qui permet de serrer le stop progressivement.

    Stop initial ATR + Take profit :

    • Un stop de sécurité fixe (1,5 x ATR) protège contre un retournement brutal avant que le SAR ne réagisse. Un take profit à 2 x ATR garantit un ratio risque/rendement d’au moins 1:1,33.

    Conseils d’optimisation :

    • Tester lookback entre 10 et 30, confirmBars entre 1 et 3.
    • Sur M5 en Forex, réduire sarMax à 0,1 pour un trailing plus souple.
    • Ajouter DEFPARAM FlatAfter = 215900 pour éviter les positions overnight.
    robertogozzi thanked this post
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Turtle soup snail trading stratégie pour ProRealTime


ProOrder : Trading Automatique & Backtests

New Reply
Author
Summary

This topic contains 10 replies,
has 4 voices, and was last updated by Nicolas
2 days, 4 hours ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 04/11/2026
Status: Active
Attachments: No files
Logo Logo
Loading...