Indicateurs de signaux scalping m1
Forums › ProRealTime forum Français › Support ProBuilder › Indicateurs de signaux scalping m1
- This topic has 4 replies, 2 voices, and was last updated 11 months ago by FXtonio.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
12/06/2023 at 11:11 AM #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=4strategy(“Gold M1 RSI + CE + BJ”, overlay = true)// ####################################################// RSIma(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.0upIndic = 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)// #################################// DEMAlength = input(170, minval=1)src = input(close, title=”Source”)e1 = ema(src, length)e2 = ema(e1, length)dema = 2 * e1 – e2plot(dema, “DEMA”, color= color.white)// ##############################################// CHANDELIER EXITlengthCE = 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)) – atrlongStopPrev=nz(longStop[1],longStop)longStop := close[1] > longStopPrev ? max(longStop, longStopPrev) : longStopshortStop = (useClose ? lowest(close, lengthCE) : lowest(lengthCE)) + atrshortStopPrev = nz(shortStop[1], shortStop)shortStop := close[1] < shortStopPrev ? min(shortStop, shortStopPrev) : shortStopvar int dir = 1dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dirvar color longColor = color.greenvar color shortColor = color.redbuySignalCE = dir == 1 and dir[1] == -1plotshape(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] == 1plotshape(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 = 0bjrev = strat_val < 1hema = strat_val > 0 and strat_val < 2trm =strat_val>1and strat_val<3rsicol = strat_val > 2 and strat_val < 4t3vis = falsehemavis = falsepsarvis =falsearrowvis = false// TRMtsistrat = “Fast”tsistrat_val = tsistrat == “Fast” ? 0 : tsistrat == “Slow” ? 1 : natsifast = tsistrat_val < 1tsislow =tsistrat_val>0longf = 25shortf = 5signalf = 14longs = 25shorts = 13signals = 13lenf = 5lens = 14shortvar = tsifast ? shortf : tsislow ? shorts : nalongvar = tsifast ? longf : tsislow ? longs : nasignalvar = tsifast ? signalf : tsislow ? signals : natsi = tsi(close,shortvar,longvar)tsl = ema(tsi, signalvar)// HAhaClose = (open + high + low + close) / 4haOpen = float(na)haOpen := na(haOpen[1]) ? (open + close) / 2 : (nz(haOpen[1]) + nz(haClose[1])) / 2haHigh = max(high, max(haOpen, haClose))haLow = min(low, min(haOpen, haClose))// RSI Bar Colorrsistrat = “Slow”rsistrat_val = rsistrat == “Slow” ? 11 : rsistrat == “Fast” ? 12 : narsifast = rsistrat_val > 11rsislow =rsistrat_val<12len =tsifast and trm ? lenf :tsislow and trm ? lens :rsifast and rsicol ? lenf :rsislow and rsicol ? lens : lensrsi = rsi(close,len)buy1 = crossover(tsi,tsl) and rsi > 50buy2 = crossover(rsi,50) and tsi > tslbuy3 = crossover(tsi,tsl) and crossover(rsi,50)buy4 = buy1 or buy2 or buy3sell1 = crossunder(tsi,tsl) and rsi < 50sell2 = crossunder(rsi,50) and tsi < tslsell3 = crossunder(tsi,tsl) and crossunder(rsi,50)sell4 = sell1 or sell2 or sell3buy = tsi > tsl and rsi > 50sell =tsi<tsland rsi<50rsicross =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 MA5aLength = 6AxPrice = closeaxe1 = 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.7ac1 = -ab*ab*abac2 = 3*ab*ab+3*ab*ab*abac3 = -6*ab*ab-3*ab-3*ab*ab*abac4 = 1+3*ab+ab*ab*ab+3*ab*abanT3Average = ac1 * axe6 + ac2 * axe5 + ac3 * axe4 + ac4 * axe3colOne =anT3Average>anT3Average[1]colTwo =anT3Average<anT3Average[1]color2 = colOne ? #64b5f6 : colTwo ? #ef5350 : nap2 = plot(anT3Average, color= t3vis ? color2 : bjrev ? color2 : true ? na : #ffffff , transp=100, title=”T3 Fast”)///T3 MA8Length = 8xPrice = closexe1 = 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.7c1 = -b*b*bc2 = 3*b*b+3*b*b*bc3 = -6*b*b-3*b-3*b*b*bc4 = 1+3*b+b*b*b+3*b*bnT3Average = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3upCol =nT3Average>nT3Average[1]downCol = nT3Average < nT3Average[1]myColor = upCol ? #64b5f6 : downCol ? #ef5350 : nap1 = 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 Filluc = (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 >= haOpenhadd = haClose < haOpenfillData = nT3Average < anT3AveragefillDtat = nT3Average > anT3AveragefillCol = fillData ? #64b5f6 : fillDtat ? #ef5350 : nafill (p1,p2, color=t3vis ? fillCol : bjrev ? fillCol : na, transp=15, title=”T3 Fill”)// HEMAhemaslow = 5bjhemaslow = ema (haOpen, hemaslow)up = bjhemaslow > bjhemaslow[1]down = bjhemaslow < bjhemaslow[1]mycolor = up ? #64b5f6 : down ? #d32f2f : nabjhemafast = ema(hl2, 1)hemaslow2 = 9bjhemaslow2 = ema(haOpen, hemaslow2)up2 = bjhemaslow2 > bjhemaslow2[1]down2 = bjhemaslow2 < bjhemaslow2[1]mycolor2 = up2 ? #64b5f6 : down2 ? #d32f2f : nahemaslow3 = 21bjhemaslow3 = ema(haOpen, hemaslow3)up3 = bjhemaslow3 > bjhemaslow3[1]down3 = bjhemaslow3 < bjhemaslow3[1]mycolor3 = up3 ? #64b5f6 : down3 ? #d32f2f : naemasig = cross (close, bjhemaslow) and cross(close, bjhemaslow2)// HEMA area plot fillhfillData = bjhemaslow > bjhemafasthfillData2 = bjhemaslow < bjhemafasthfillDtat = bjhemaslow2 > bjhemaslowhfillDtat2 = bjhemaslow2 < bjhemaslowhfillDat = bjhemaslow3 > bjhemaslow2hfillDat2 = bjhemaslow3 < bjhemaslow2hemauc = (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 crossup3Hcrossdwn = 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 : nabuySignal = rsiIndic > rsiMA and close > dema and buySignalCE and fillCol == #64b5f6 and (rsiIndic – rsiMA) > 1.8 // 2.8sellSignal = rsiIndic < rsiMA and close < dema and sellSignalCE and fillCol == #ef5350 and (rsiIndic – rsiMA) < -1.8 //-2.8// === INPUT DATE RANGE ===fromMonth = 1fromDay = 1fromYear = 2021thruMonth = 1thruDay = 1thruYear = 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 startfinish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // date finishisDate = 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’analyseuse_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_sizelowestt = 0.0highestt = 0.0if buySignallowestt := lowest(low, 2)highestt := close + (close – lowestt)*1.5if sellSignallowestt := highest(high, 2)highestt := close + (close – lowestt)*1.5// var SL = 0.0// var TP = 0.0isTradeInTime = time >= timestamp(“GMT+2”, year, month, dayofmonth, 7, 30) and time <= timestamp(“GMT+2”, year, month, dayofmonth, 20, 10)if (isTradeInTime)open_long = buySignalopen_short = sellSignalif open_long and strategy.opentrades == 0strategy.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_valuestrategy.exit(“Exit Long”, “BUY”, stop = lowestt, limit = highestt)if open_short and strategy.opentrades == 0strategy.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_valuestrategy.exit(“Exit Short”, “SELL”, stop = lowestt, limit = highestt)//—————————————–//————–Backtest——————-strategy_pnl = strategy.netprofit + strategy.openprofitbnh_strategy_pnl_pcnt = (strategy_pnl / strategy.initial_capital) * 100float bnh_start_bar = nabnh_start_bar := na(bnh_start_bar[1]) or inDateRange != true? close : bnh_start_bar[1]float bnl_buy_hold_equity = nabnl_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_equitybnh_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)12/06/2023 at 12:23 PM #22493412/06/2023 at 5:00 PM #22496412/06/2023 at 5:29 PM #22496512/07/2023 at 11:34 AM #224981 -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
Find exclusive trading pro-tools on
Similar topics: