Conversion Pine Script Tradingwiew en PRT
Forums › ProRealTime forum Français › Support ProBuilder › Conversion Pine Script Tradingwiew en PRT
- This topic has 0 replies, 1 voice, and was last updated 4 months ago by larouedegann.
Viewing 1 post (of 1 total)
-
-
12/16/2023 at 9:14 PM #225352
Bonjour à tous,
Ci-joint le pine script de tradeforopp de tradingwiew.
Ne connaissant rien en pine script, si un informaticien pourrait aider
merci
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198/@version=5indicator("Protected Highs & Lows [TFO]", "Protected Highs & Lows [TFO]", true, max_lines_count = 500, max_labels_count = 500)var g_STR = "Structure"ps = input.int(1, "Pivot Strength", group = g_STR)color_trend = input.bool(true, "Trend Candles", inline = "TREND", group = g_STR)show_labels = input.bool(true, "Show Structure Labels", inline = "MSS", group = g_STR)label_type = input.string("MSS", "", options = ['MSS', 'BOS', 'All'], inline = "MSS", group = g_STR)var g_PHL = "Protected Highs & Lows"show_phl = input.bool(true, "Show Protected Highs & Lows", inline = "PHL", group = g_PHL)trail_phl = input.bool(true, "Show Protected Trail", inline = "TRAIL", group = g_PHL)trail_width = input.int(2, "", inline = "TRAIL", group = g_PHL)ph_color = input.color(color.red, "", inline = "PHL", group = g_PHL)pl_color = input.color(color.blue, "", inline = "PHL", group = g_PHL)bull_color = input.color(color.teal, "", inline = "TREND", group = g_STR)bear_color = input.color(color.red, "", inline = "TREND", group = g_STR)var bool bull = navar float trail_price = navar color trail_color = navar ph = array.new_float()var pl = array.new_float()var pht = array.new_int()var plt = array.new_int()var float last_high = navar float last_low = navar int last_high_idx = navar int last_low_idx = navar float track_high = navar float track_low = navar int track_high_idx = navar int track_low_idx = natype dwglabel[] _labellabel[] _phlline[] _linebool[] _bullmethod dwg_add(dwg d, label LB, label PHL, line LN, bool BL) =>d._label.unshift(LB)d._phl.unshift(PHL)d._line.unshift(LN)d._bull.unshift(BL)clear_all() =>pl.clear()plt.clear()ph.clear()pht.clear()if ta.pivotlow(low, ps, ps) and pl.size() == 0pl.unshift(low[ps])plt.unshift(time[ps])if na(last_low)last_low := low[ps]last_low_idx := bar_index - pselseif low[ps] < last_lowlast_low := low[ps]last_low_idx := bar_index - psif ta.pivothigh(high, ps, ps) and ph.size() == 0ph.unshift(high[ps])pht.unshift(time[ps])if na(last_high)last_high := high[ps]last_high_idx := bar_index - pselseif high[ps] > last_highlast_high := high[ps]last_high_idx := bar_index - psif (high[ps] > track_high or na(track_high) or last_low_idx >= track_high_idx) and not na(ta.pivothigh(high, ps, ps))track_high := high[ps]track_high_idx := bar_index - psif (low[ps] < track_low or na(track_low) or last_high_idx >= track_low_idx) and not na(ta.pivotlow(low, ps, ps))track_low := low[ps]track_low_idx := bar_index - psbos_bear = falsebos_bull = falsemss_bear = falsemss_bull = falsechange = falsevar dwgs = dwg.new(array.new_label(), array.new_label(), array.new_line(), array.new_bool())if ph.size() > 0if close > ph.get(0)label _label = nalabel _phl = naif show_labelssave = falseif label_type == 'MSS' and not bullsave := trueelse if label_type == 'BOS' and bullsave := trueelse if label_type == 'All'save := trueif save_label := label.new(math.floor(math.avg(time, pht.get(0))), ph.get(0), bull ? "BOS" : "MSS", xloc = xloc.bar_time, style = label.style_label_down, color = #ffffff00, textcolor = na)if bullbos_bull := trueelsemss_bull := true_line = line.new(pht.get(0), ph.get(0), time, ph.get(0), color = na, xloc = xloc.bar_time, style = line.style_dashed)bull := truechange := trueclear_all()if not na(track_low)if show_phl_phl := label.new(time[bar_index - track_low_idx], track_low, "▲", xloc = xloc.bar_time, style = label.style_label_up, textcolor = na, color = #ffffff00)pl.unshift(track_low)plt.unshift(time[bar_index - track_low_idx])last_high := nadwgs.dwg_add(_label, _phl, _line, bull)if pl.size() > 0if close < pl.get(0)label _label = nalabel _phl = naif show_labelssave = falseif label_type == 'MSS' and bullsave := trueelse if label_type == 'BOS' and not bullsave := trueelse if label_type == 'All'save := trueif save_label := label.new(math.floor(math.avg(time, plt.get(0))), pl.get(0), not bull ? "BOS" : "MSS", xloc = xloc.bar_time, style = label.style_label_up, color = #ffffff00, textcolor = na)if not bullbos_bear := trueelsemss_bear := true_line = line.new(plt.get(0), pl.get(0), time, pl.get(0), color = na, xloc = xloc.bar_time, style = line.style_dashed)bull := falsechange := trueclear_all()if not na(track_high)if show_phl_phl := label.new(time[bar_index - track_high_idx], track_high, "▼", xloc = xloc.bar_time, style = label.style_label_down, textcolor = na, color = #ffffff00)ph.unshift(track_high)pht.unshift(time[bar_index - track_high_idx])last_low := nadwgs.dwg_add(_label, _phl, _line, bull)if change[1]if bos_bear[1] or mss_bear[1]trail_price := track_hightrail_color := ph_colorelse if bos_bull[1] or mss_bull[1]trail_price := track_lowtrail_color := pl_color_bull = dwgs._bull.get(0)dwgs._label.get(0).set_textcolor(_bull ? bull_color : bear_color)dwgs._phl.get(0).set_textcolor(_bull ? pl_color : ph_color)dwgs._line.get(0).set_color(_bull ? bull_color : bear_color)barcolor(color_trend ? (bull ? bull_color : bear_color) : na)plot(trail_phl ? trail_price : na, color = trail_color, linewidth = trail_width)alertcondition(bos_bear[1] or bos_bull[1], "BOS Any")alertcondition(mss_bear[1] or mss_bull[1], "MSS Any")alertcondition(bos_bear[1], "BOS Bear")alertcondition(bos_bull[1], "BOS Bull")alertcondition(mss_bear[1], "MSS Bear")alertcondition(mss_bull[1], "MSS Bull") -
AuthorPosts
Viewing 1 post (of 1 total)
Find exclusive trading pro-tools on
Similar topics: