Indicateurs de signaux scalping m1

Forums ProRealTime forum Français Support ProBuilder Indicateurs de signaux scalping m1

Viewing 5 posts - 1 through 5 (of 5 total)
  • #224925

    Bonjour à tous  🙂

    Ci-dessous un indicateur de scalping très efficace sur le gold et le dax en M1,

    il est en pine script, (je ne maitrise pas encore pro builder)

    Si quelqu’un est intéressé pour le convertir sur prt..

    Bonne journée à tous.

     

     

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © HunterXTrader
    //@version=4
    strategy(“Gold M1 RSI + CE + BJ”, overlay = true)
    // ####################################################
    // RSI
    ma(source, length, type) => sma(source, length)
    rsiLengthInput = input(25, minval=1, title=”RSI Length”, group=”RSI Settings”)
    rsiSourceInput = input(close, “Source”, group=”RSI Settings”)
    maTypeInput = input(“SMA”, title=”MA Type”, options=[“SMA”, “EMA”], group=”MA Settings”)
    maLengthInput = input(150, title=”MA Length”, group=”MA Settings”)
    bbMultInput = 2.0
    upIndic = rma(max(change(rsiSourceInput), 0), rsiLengthInput)
    downIndic = rma(-min(change(rsiSourceInput), 0), rsiLengthInput)
    rsiIndic = downIndic == 0 ? 100 : upIndic == 0 ? 0 : 100 – (100 / (1 + upIndic / downIndic))
    rsiMA = ma(rsiIndic, maLengthInput, maTypeInput)
    // #################################
    // DEMA
    length = input(170, minval=1)
    src = input(close, title=”Source”)
    e1 = ema(src, length)
    e2 = ema(e1, length)
    dema = 2 * e1 – e2
    plot(dema, “DEMA”, color= color.white)
    // ##############################################
    // CHANDELIER EXIT
    lengthCE = input(title=”ATR Period”, type=input.integer, defval=1)
    mult = input(title=”ATR Multiplier”, type=input.float, step=0.1, defval=2.3)
    showLabels = input(title=”Show Buy/Sell Labels ?”, type=input.bool, defval=true)
    useClose = input(title=”Use Close Price for Extremums ?”, type=input.bool, defval=true)
    atr = mult * atr(lengthCE)
    longStop = (useClose ? highest(close, lengthCE) : highest(lengthCE)) – atr
    longStopPrev=nz(longStop[1],longStop)
    longStop := close[1] > longStopPrev ? max(longStop, longStopPrev) : longStop
    shortStop = (useClose ? lowest(close, lengthCE) : lowest(lengthCE)) + atr
    shortStopPrev = nz(shortStop[1], shortStop)
    shortStop := close[1] < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop
    var int dir = 1
    dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir
    var color longColor = color.green
    var color shortColor = color.red
    buySignalCE = dir == 1 and dir[1] == -1
    plotshape(buySignalCE and showLabels ? longStop : na, title=”Buy Label”, text=”Buy”, location=location.absolute, style=shape.labelup, size=size.tiny, color=longColor, textcolor=color.white, transp=0)
    sellSignalCE = dir == -1 and dir[1] == 1
    plotshape(sellSignalCE and showLabels ? shortStop : na, title=”Sell Label”, text=”Sell”, location=location.absolute, style=shape.labeldown, size=size.tiny, color=shortColor, textcolor=color.white, transp=0)
    midPricePlot = plot(ohlc4, title=””, style=plot.style_circles, linewidth=0, display=display.none, editable=false)
    // #########################################
    // BJ SUPERSCRIPT
    // ¦¦¦¦¦¦+¦¦¦¦¦¦¦¦+¦¦¦¦¦¦+¦¦¦¦¦¦¦+¦¦¦¦¦¦¦¦+¦¦¦+¦¦¦¦¦+¦¦¦+¦¦¦¦¦¦+
    // ¦¦+–¦¦+¦¦¦¦¦¦¦¦¦¦+–¦¦+¦¦+–¦¦+¦¦+—-+¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦¦¦
    // ¦¦¦¦¦¦-+¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+¦¦¦
    // ¦¦+–¦¦+¦¦+¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+–¦¦+¦¦¦¦¦+¦¦+¦¦¦¦¦¦¦¦¦¦¦¦+¦¦++¦¦¦
    // ¦¦¦¦¦¦-++¦¦¦¦¦+++¦¦¦¦¦++¦¦¦¦¦¦¦¦+¦¦¦¦¦¦+++¦¦¦¦¦¦++¦¦¦¦+-+¦¦¦¦
    // +—–+¦¦+—-+¦¦+—-+¦+-+¦¦+-+¦+—–+¦¦+—–+¦+-+¦¦¦¦¦+-+
    strat           = “Bj Reversal”
    strat_val       = 0
    bjrev           = strat_val < 1
    hema            = strat_val > 0 and                 strat_val < 2
    trm             =strat_val>1and                 strat_val<3
    rsicol          = strat_val > 2 and                 strat_val < 4
    t3vis           = false
    hemavis         = false
    psarvis         =false
    arrowvis        = false
    // TRM
    tsistrat        = “Fast”
    tsistrat_val    = tsistrat == “Fast” ? 0 :          tsistrat == “Slow” ? 1 : na
    tsifast         = tsistrat_val < 1
    tsislow         =tsistrat_val>0
    longf           = 25
    shortf          = 5
    signalf         = 14
    longs           = 25
    shorts          = 13
    signals         = 13
    lenf            = 5
    lens            = 14
    shortvar        = tsifast ? shortf                  : tsislow ? shorts                              : na
    longvar         = tsifast ? longf                   : tsislow ? longs                               : na
    signalvar       = tsifast ? signalf                 : tsislow ? signals                             : na
    tsi             = tsi(close,shortvar,longvar)
    tsl             = ema(tsi, signalvar)
    // HA
    haClose         = (open + high + low + close) / 4
    haOpen          = float(na)
    haOpen          := na(haOpen[1]) ? (open + close) / 2 : (nz(haOpen[1]) + nz(haClose[1])) / 2
    haHigh          = max(high, max(haOpen, haClose))
    haLow           = min(low,  min(haOpen, haClose))
    // RSI Bar Color
    rsistrat        = “Slow”
    rsistrat_val    = rsistrat == “Slow” ? 11 :         rsistrat == “Fast” ? 12 : na
    rsifast         = rsistrat_val > 11
    rsislow         =rsistrat_val<12
    len             =tsifast and trm    ? lenf :
                     tsislow and trm    ? lens :
                     rsifast and rsicol ? lenf :
                     rsislow and rsicol ? lens : lens
    rsi             = rsi(close,len)
    buy1            = crossover(tsi,tsl) and rsi > 50
    buy2            = crossover(rsi,50)  and tsi > tsl
    buy3            = crossover(tsi,tsl) and crossover(rsi,50)
    buy4            = buy1 or buy2 or buy3
    sell1           = crossunder(tsi,tsl) and rsi < 50
    sell2           = crossunder(rsi,50)  and tsi < tsl
    sell3           = crossunder(tsi,tsl) and crossunder(rsi,50)
    sell4           = sell1 or sell2 or sell3
    buy             = tsi > tsl and  rsi > 50
    sell            =tsi<tsland  rsi<50
    rsicross        =cross         (rsi,50)
    rsiup           =crossover     (rsi,50)
    rsidwn          =crossunder    (rsi,50)
    rsiob           =crossover     (rsi,70)
    rsios           =crossunder    (rsi,30)
    rsicd           =crossunder    (rsi,70)
    rsicu           =crossover     (rsi,30)
    // Bj Reversal
        ///T3 MA5
    aLength         = 6
    AxPrice         = close
    axe1            = ema(AxPrice, aLength)
    axe2            = ema(axe1, aLength)
    axe3            = ema(axe2, aLength)
    axe4            = ema(axe3, aLength)
    axe5            = ema(axe4, aLength)
    axe6            = ema(axe5, aLength)
    ab              = 0.7
    ac1             = -ab*ab*ab
    ac2             = 3*ab*ab+3*ab*ab*ab
    ac3             = -6*ab*ab-3*ab-3*ab*ab*ab
    ac4             = 1+3*ab+ab*ab*ab+3*ab*ab
    anT3Average     = ac1 * axe6 + ac2 * axe5 + ac3 * axe4 + ac4 * axe3
    colOne          =anT3Average>anT3Average[1]
    colTwo          =anT3Average<anT3Average[1]
    color2          = colOne ? #64b5f6 : colTwo ? #ef5350 : na
    p2              = plot(anT3Average, color= t3vis ? color2 : bjrev ? color2 : true ? na : #ffffff , transp=100, title=”T3 Fast”)
        ///T3 MA8
    Length          = 8
    xPrice          = close
    xe1             = ema(xPrice, Length)
    xe2             = ema(xe1, Length)
    xe3             = ema(xe2, Length)
    xe4             = ema(xe3, Length)
    xe5             = ema(xe4, Length)
    xe6             = ema(xe5, Length)
    b               = 0.7
    c1              = -b*b*b
    c2              = 3*b*b+3*b*b*b
    c3              = -6*b*b-3*b-3*b*b*b
    c4              = 1+3*b+b*b*b+3*b*b
    nT3Average      = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3
    upCol           =nT3Average>nT3Average[1]
    downCol         = nT3Average < nT3Average[1]
    myColor         = upCol ? #64b5f6 : downCol ? #ef5350 : na
    p1              = plot(nT3Average, color=t3vis ? myColor : bjrev ? myColor : true ? na : #ffffff , transp=100, title=”T3 Slow”)
    revbar          = cross(close, nT3Average)
    trendbar        = cross(nT3Average, anT3Average)
    revup           = crossover(close, nT3Average)
    revdwn          = crossunder(close, nT3Average)
    // Bj Reversal Bar Color and Fill
    uc              = (close >   nT3Average) and            (anT3Average >= nT3Average)
    dc              = (close <   nT3Average) and            (anT3Average <= nT3Average)
    dr              =(close<   nT3Average)and            (anT3Average>=nT3Average)
    ur              =(close>   nT3Average)and            (anT3Average<=nT3Average)
    hauc            = (haClose > nT3Average) and            (anT3Average >= nT3Average)
    hadc            = (haClose < nT3Average) and            (anT3Average <= nT3Average)
    hadr            = (haClose < nT3Average) and            (anT3Average >= nT3Average)
    haur            = (haClose > nT3Average) and            (anT3Average <= nT3Average)
    hadu            = haClose >= haOpen
    hadd            = haClose <  haOpen
    fillData        = nT3Average < anT3Average
    fillDtat        = nT3Average > anT3Average
    fillCol         = fillData ? #64b5f6 :                  fillDtat ? #ef5350 : na
    fill            (p1,p2, color=t3vis ? fillCol :         bjrev ? fillCol : na,               transp=15, title=”T3 Fill”)
    // HEMA
    hemaslow        = 5
    bjhemaslow      = ema (haOpen, hemaslow)
    up              = bjhemaslow > bjhemaslow[1]
    down            = bjhemaslow < bjhemaslow[1]
    mycolor         = up ? #64b5f6 : down ? #d32f2f : na
    bjhemafast      = ema(hl2, 1)
    hemaslow2       = 9
    bjhemaslow2     = ema(haOpen, hemaslow2)
    up2             = bjhemaslow2 > bjhemaslow2[1]
    down2           = bjhemaslow2 < bjhemaslow2[1]
    mycolor2        = up2 ? #64b5f6 : down2 ? #d32f2f : na
    hemaslow3       = 21
    bjhemaslow3     = ema(haOpen, hemaslow3)
    up3             = bjhemaslow3 > bjhemaslow3[1]
    down3           = bjhemaslow3 < bjhemaslow3[1]
    mycolor3        = up3 ? #64b5f6 : down3 ? #d32f2f : na
    emasig          = cross (close, bjhemaslow) and         cross(close, bjhemaslow2)
    // HEMA area plot fill
    hfillData       = bjhemaslow > bjhemafast
    hfillData2      = bjhemaslow < bjhemafast
    hfillDtat       = bjhemaslow2 > bjhemaslow
    hfillDtat2      = bjhemaslow2 < bjhemaslow
    hfillDat        = bjhemaslow3 > bjhemaslow2
    hfillDat2       = bjhemaslow3 < bjhemaslow2
    hemauc          =               (close> bjhemaslow)  and (close > bjhemaslow2)
    hemadc          =               (close< bjhemaslow)  and (close < bjhemaslow2)
    crossup1        = crossover     (close, bjhemaslow)  and (close > bjhemaslow2)
    crossup2        = crossover     (close, bjhemaslow2) and (close > bjhemaslow)
    crossup3        = crossover     (close, bjhemaslow2) and crossover(close, bjhemaslow)
    crossdown1      = crossunder    (close, bjhemaslow)  and (close < bjhemaslow2)
    crossdown2      = crossunder    (close, bjhemaslow2) and (close < bjhemaslow)
    crossdown3      = crossunder    (close, bjhemaslow2) and crossunder(close, bjhemaslow)
    Hcrossup        = crossup1   or crossup2   or crossup3
    Hcrossdwn       = crossdown1 or crossdown2 or crossdown3
    // alertcondition   (revbar,           title=’Bj Reversal’,            message=’Reversal candle is forming on {{interval}} chart. Price is {{close}}’)
    // alertcondition   (revup,            title=’Reversal Up’,            message=’Reversal up on {{interval}} chart. Price is {{close}}’)
    // alertcondition   (revdwn,           title=’Reversal Down’,          message=’Reversal down on {{interval}} chart. Price is {{close}}’)
    //  ____  __ _  ____
    // (  __)(  ( \(    \
    //  ) _) /    / ) D (
    // (____)\_)__)(____/
    // fillCol         = fillData ? #64b5f6 :                  fillDtat ? #ef5350 : na
    buySignal =  rsiIndic > rsiMA  and close > dema and buySignalCE and fillCol == #64b5f6 and (rsiIndic – rsiMA) > 1.8 // 2.8
    sellSignal = rsiIndic < rsiMA  and close < dema and sellSignalCE and fillCol == #ef5350 and (rsiIndic – rsiMA) < -1.8 //-2.8
    // === INPUT DATE RANGE ===
    fromMonth  = 1
    fromDay    = 1
    fromYear   = 2021
    thruMonth  = 1
    thruDay    = 1
    thruYear   = 2112
    // === INPUT TIME RANGE ===
    entryTime  = ‘0000-0000’ //input(‘0000-0000’,  title = “Entry Time”, type=input.session)   // ‘0000-0000′ is anytime to enter //’0800-1800’
    exitTime   = ‘0000-0000’                                                     // ‘0000-0000′ is anytime to exit //’0800-1800’
    // === DATE & TIME RANGE FUNCTIONS ===
    isDate() =>                                                               // create function “within window of dates”
        start  = timestamp(fromYear, fromMonth, fromDay, 00, 00)              // date start
        finish = timestamp(thruYear, thruMonth, thruDay, 23, 59)              // date finish
        isDate = time >= start and time <= finish                             // current date is “within window of dates”
    isTime(_position) =>                                                      // create function “within window of time”
        isTime = time(timeframe.period, _position)// + ‘:1234567’)               // current time is “within window of time”
    // // Période d’analyse
    use_period = true //input(type=input.bool, defval=true, title=”Période spécifique ?”, group=”periode”)
    startDate = timestamp(“01 Jan 2020”) // input(timestamp(“01 Jan 2020”), “Date de début”, group=”periode”, type = input.time)
    endDate = timestamp(“01 Jan 2025”) //input(timestamp(“01 Jan 2025”), “Date de fin”, group=”periode”, type = input.time)
    // //——————————————
    // //————-Indicateurs——————
    inDateRange = use_period ? ((time >= startDate) and (time < endDate)) : true
    //—————————————–
    //————Stratégie——————–
    //SL & TP
    // Définition de la gestion de risque
    // risk_pct = 1 // Pourcentage du capital à risquer
    // capital = 10000 // Capital initial
    // risk_amt = (risk_pct / 100) * capital // Montant à risquer
    // stop_loss_distance = atr(10) // Distance du stop loss
    // take_profit_distance = stop_loss_distance * 1.5 // Distance du take profit
    // stop_loss_price = valuewhen(high == highest(high, 10), high, 0) // Dernier swing high des 10 dernières bougies
    // take_profit_price = close + take_profit_distance // Prix du take profit
    // Calcul du montant de la position en fonction du risque
    // position_size = (risk_amt / stop_loss_distance) / syminfo.mintick
    //strategy.position_size := position_size
    lowestt = 0.0
    highestt = 0.0
    if buySignal
        lowestt := lowest(low, 2)
        highestt := close + (close – lowestt)*1.5
    if sellSignal
        lowestt := highest(high, 2)
        highestt := close + (close – lowestt)*1.5
    // var SL = 0.0
    // var TP = 0.0
    isTradeInTime = time >= timestamp(“GMT+2”, year, month, dayofmonth, 7, 30) and time <= timestamp(“GMT+2”, year, month, dayofmonth, 20, 10)
    if (isTradeInTime)
        open_long = buySignal
        open_short = sellSignal
        if open_long and strategy.opentrades == 0
            strategy.entry(“BUY”, true)//, when = isDate() and isTime(entryTime))
            alert(‘Buy Signal Alert’, alert.freq_once_per_bar_close)
            //strategy.close(“long”, when = sellSignal)
        //strategy.exit(‘long exit’,’long’, profit = tp_value, loss = sl_value)//profit = 20, loss = 30) //limit = tp_value, stop = sl_value
        strategy.exit(“Exit Long”, “BUY”, stop = lowestt, limit = highestt)
        if open_short and strategy.opentrades == 0
            strategy.entry(“SELL”, false)//, when = isDate() and isTime(entryTime))
            alert(‘Sell Signal Alert’, alert.freq_once_per_bar_close)
        //strategy.exit(‘short exit’,’short’, profit = tp_value, loss = sl_value) // profit = 20, loss = 30 ) //limit = tp_value, stop = sl_value
        strategy.exit(“Exit Short”, “SELL”, stop = lowestt, limit = highestt)
    //—————————————–
    //————–Backtest——————-
    strategy_pnl = strategy.netprofit + strategy.openprofit
    bnh_strategy_pnl_pcnt = (strategy_pnl / strategy.initial_capital) * 100
    float bnh_start_bar = na
    bnh_start_bar := na(bnh_start_bar[1]) or inDateRange != true? close : bnh_start_bar[1]
    float bnl_buy_hold_equity = na
    bnl_buy_hold_equity :=  inDateRange == true ? ((close – bnh_start_bar)/bnh_start_bar) * 100 : bnl_buy_hold_equity[1]
    bnh_vs_diff = bnh_strategy_pnl_pcnt – bnl_buy_hold_equity
    bnh_diff_color = bnh_vs_diff > 0 ? color.new(color.green, inDateRange ? 60 : 100) : color.new(color.red, inDateRange ? 60 : 100)
    //—————————————-
    //—————-Table——————-
    // var Table2 = table.new(position.top_right, columns = 2, rows = 5, border_width = 1, bgcolor = color.black, border_color = color.gray)
    // table.cell(table_id = Table2, column = 0, row = 0, text_color=(bnh_strategy_pnl_pcnt>bnl_buy_hold_equity)?color.gray:color.green, text_size = size.normal, text = “Buy & hold profit”)
    // table.cell(table_id = Table2, column = 1, row = 0, text_color=(bnh_strategy_pnl_pcnt>bnl_buy_hold_equity)?color.gray:color.green, text_size = size.normal, text = tostring(bnl_buy_hold_equity, ‘#.##’) + ‘ %’)
    // table.cell(table_id = Table2, column = 0, row = 1, text_color=(bnh_strategy_pnl_pcnt<bnl_buy_hold_equity)?color.gray:color.green, text_size = size.normal, text = “Strategy profit”)
    // table.cell(table_id = Table2, column = 1, row = 1, text_color=(bnh_strategy_pnl_pcnt<bnl_buy_hold_equity)?color.gray:color.green, text_size = size.normal, text = tostring(bnh_strategy_pnl_pcnt, ‘#.##’) + ‘ %’)
    // table.cell(table_id = Table2, column = 0, row = 2, text_color=color.yellow, text_size = size.normal, text = “Winrate”)
    // table.cell(table_id = Table2, column = 1, row = 2, text_color=color.yellow, text_size = size.normal, text = tostring(strategy.wintrades/strategy.closedtrades*100, ‘#.##’) + ‘ %’)
    // table.cell(table_id = Table2, column = 0, row = 3, text_color=color.yellow, text_size = size.normal, text = “Date de début”)
    // table.cell(table_id = Table2, column = 1, row = 3, text_color=color.yellow, text_size = size.normal, text = str.format(“{0,date,dd-MM-YYYY}”,startDate))
    // table.cell(table_id = Table2, column = 0, row = 4, text_color=color.yellow, text_size = size.normal, text = “Date de fin”)
    // table.cell(table_id = Table2, column = 1, row = 4, text_color=color.yellow, text_size = size.normal, text = str.format(“{0,date,dd-MM-YYYY}”, endDate))
    // //Plot the SL &TP
    // var fix_high = 0.0
    // var fix_low = 0.0
    // var fix_close = 0.0
    // if strategy.opentrades>0 and strategy.opentrades[1]==0 and strategy.position_size > 0
    //     fix_high := highestt// tp_value[1] //highestt
    //     fix_low := lowestt //sl_value[1] //lowestt
    //     fix_close := close[1]
    // //line
    // var line line_up = na
    // var line line_low = na
    // var line line_close = na
    // //box
    // var box box_low = na
    // var box box_up = na
    // if strategy.opentrades > 0 and strategy.opentrades[1]==0 and strategy.position_size > 0
    //     //line
    //     line_up := line.new(bar_index, fix_high, bar_index + 1, fix_high, color = color.green, width = 2)
    //     line_low := line.new(bar_index, fix_low, bar_index + 1, fix_low, color = color.red, width = 2)
    //     line_close := line.new(bar_index, fix_close, bar_index + 1, fix_close, color = color.blue, width = 2)
    //     //box
    //     box_up := box.new(bar_index, fix_high, bar_index + 1, fix_close, border_color = color.new(color.green,70),  bgcolor = color.new(color.green,70))
    //     box_low := box.new(bar_index, fix_close, bar_index + 1, fix_low, border_color = color.new(color.red,70),  bgcolor = color.new(color.red,70))
    // if strategy.opentrades==0 and strategy.opentrades[1]==1
    //     //line
    //     line.set_x2(line_up,bar_index + 2)
    //     line.set_x2(line_low,bar_index + 2)
    //     line.set_x2(line_close,bar_index + 2)
    //     //box
    //     box.set_rightbottom(box_up, bar_index + 2 , fix_close)
    //     box.set_rightbottom(box_low, bar_index + 2 , fix_low)

     

    #224934

    Est-il possible de mettre un lien vers l’original ?

    #224964

    Bonjours,

    désolé c’est un code que j’ai trouver sur un forum j’ai juste fais un copié coller sur trading view, l’indicateur n’est pas répertorié dans TW

    #224965

    C’est qu’il est long et avant de passer du temps à le convertir, j’aimerais savoir s’il en vaut le coup… A-t’il était testé? Une photo des résultats ?

    #224981

    Bonjour,

    ci-joint un pdf des resultats.

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login