Conversion STOP HUNT indicateur

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #239141 quote
    Med5
    Participant
    Junior

    Bonjour tout le monde,  j’espère que vous allez bien.

    SVP pourriez vous me convertir ce script que je trouve intéressant et peut éventuellement aider les traders da la communauté Prorealcode. Merci beaucoup

    //@version=5
    //Revision: Updated script to pine script version 5
    //added Double RSI for Long/Short prosition trend confirmation instead of single RSI
    //@author:"Iroshan_Rathnayake"
    
    strategy("Scalp_Hunt", overlay=true)
    source = close
    atrlen = input.int(14, "ATR Period")
    mult = input.float(1, "ATR Multi", step=0.1)
    smoothing = input.string(title="ATR Smoothing", defval="WMA", options=["RMA", "SMA", "EMA", "WMA"])
    ma_function(source, atrlen) =>
        if smoothing == "RMA"
            ta.rma(source, atrlen)
        else
            if smoothing == "SMA"
                ta.sma(source, atrlen)
            else
                if smoothing == "EMA"
                    ta.ema(source, atrlen)
                else
                    ta.wma(source, atrlen)
    atr_slen = ma_function(ta.tr(true), atrlen)
    upper_band = atr_slen * mult + close
    lower_band = close - atr_slen * mult
    
    // Create Indicator's
    ShortEMAlen = input.int(21, "Fast EMA")
    LongEMAlen = input.int(65, "Slow EMA")
    shortSMA = ta.ema(close, ShortEMAlen)
    longSMA = ta.ema(close, LongEMAlen)
    RSILen1 = input.int(25, "Fast RSI Length")
    RSILen2 = input.int(100, "Slow RSI Length")
    rsi1 = ta.rsi(close, RSILen1)
    rsi2 = ta.rsi(close, RSILen2)
    atr = ta.atr(atrlen)
    
    
    //RSI Cross condition
    RSILong = rsi1 > rsi2
    RSIShort = rsi1 < rsi2
    
    // Specify  conditions
    longCondition = open < lower_band
    shortCondition = open > upper_band
    GoldenLong = ta.crossover(shortSMA,longSMA)
    Goldenshort = ta.crossover(longSMA,shortSMA)
    
    plotshape(shortCondition, title="Sell Label", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
    plotshape(longCondition, title="Buy Label", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
    plotshape(Goldenshort, title="Golden Sell Label", text="Golden Crossover Short", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white, transp=0)
    plotshape(GoldenLong, title="Golden Buy Label", text="Golden Crossover Long", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.yellow, textcolor=color.white, transp=0)
    // Execute trade if condition is True
    if (longCondition)
        stopLoss = low - atr * 2
        takeProfit = high + atr * 5
        strategy.entry("long", strategy.long, when = RSILong)
    
    
    if (shortCondition)
        stopLoss = high + atr * 2
        takeProfit = low - atr * 5
        strategy.entry("short", strategy.short, when = RSIShort)
    
    
    // Plot ATR bands to chart
    
    ////ATR Up/Low Bands
    
    plot(upper_band)
    plot(lower_band)
    
    // Plot Moving Averages
    plot(shortSMA, color = color.red)
    plot(longSMA, color = color.yellow)
    #239152 quote
    Iván González
    Moderator
    Master

    Holà. Ici, vous avez la stratégie élaborée.

    defparam cumulateorders=false
    
    source=close
    atrlen=14
    mult=1
    smoothing=2
    atrSlen=average[atrlen,smoothing](tr)
    upperBand=atrSlen*mult+close
    lowerBand=-atrSlen*mult+close
    
    ShortEMAlen=21
    LongEMAlen=65
    shortSMA=average[ShortEMAlen,1](close)
    longSMA=average[LongEMAlen,1](close)
    
    RSIlen1=25
    RSIlen2=100
    rsi1=rsi[RSIlen1](close)
    rsi2=rsi[RSIlen2](close)
    atr=averagetruerange[atrlen](source)
    
    RSILong=rsi1>rsi2
    RSIshort=rsi1<rsi2
    
    longcondition=open<lowerband
    shortcondition=open>upperband
    
    GoldenLong=shortSMA crosses over longSMA
    GoldenShort=longSMA crosses over shortSMA
    
    if longCondition and RSILong then
    takeprofit=high+atr*5
    stoploss=low-atr*2
    buy 1 contract at market
    set stop price stoploss
    set target price takeprofit
    endif
    
    if shortCondition and RSIShort then
    stoploss=high+atr*2
    takeprofit=low-atr*5
    sellshort 1 contract at market
    set stop price stoploss
    set target price takeprofit
    endif
    
    graphonprice upperBand coloured("purple")
    graphonprice lowerband coloured("purple")
    graphonprice shortSMA coloured("red")
    graphonprice longSMA coloured("blue")
    
    graph RSI1 coloured("red")
    graph RSI2 coloured("blue")
    Med5 thanked this post
    #239158 quote
    Med5
    Participant
    Junior

    merci pour votre réponse , j ‘ai un msg d’erreur pour la première ligne , 34,35 et 36 , vous pouvez vérifier cela svp ?

    #239187 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    Ces messages d’erreurs laissent entrevoir la possibilité que le code a peut-être été entré par erreur dans l’onglet de gauche “indicateurs” au lieu de l’onglet “probacktest et trading auto” ?

    (cf image ci-jointe pour localiser ces onglets en v11 et en v12)

    #239266 quote
    Med5
    Participant
    Junior

    Bonjour merci pour votre réponse, mais il s’agit d’un indicateur et non pas une stratégie, j ‘ai cette erreur: commande inconnue , merci

    #239427 quote
    Med5
    Participant
    Junior

    Holà. Ici, vous avez la stratégie élaborée.

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

Conversion STOP HUNT indicateur


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Med5 @adilmed10 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Med5
1 year, 3 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 10/17/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...