Conversion indicateur TradingView
Forums › ProRealTime forum Français › Support ProBuilder › Conversion indicateur TradingView
- This topic has 3 replies, 2 voices, and was last updated 1 month ago by touline.
-
-
10/12/2024 at 8:32 AM #238885
Bonjour,
serait-il possible de convertir l’indicateur [UST] Protein+ de Tradingview Un grand merci d avance
Cordialement//@version=5
indicator(“[UST] Protein+”, max_lines_count=500, max_labels_count=500, overlay=true, max_bars_back=1000)show_current_sr = input.bool(true, title = “Show Current TF S/R”, group = “Setting”)
swing_length = input.int(10, title = ‘Swing Length’, group = ‘Setting’, minval = 1, maxval = 50)
history_of_demand_to_keep = input.int(20, title = ‘Lookback’, minval = 5, maxval = 50, group = “Setting”)
box_width = input.float(5, title = ‘S/R Range’, group = ‘Setting’, minval = 1, maxval = 10, step = 0.5)string group3 = “TF Setting”
enableHtf1 = input.bool(false, group = group3, inline = “htf1”, title = “”)
htf1 = input.timeframe(“W”, “TF1”, group = group3, inline = “htf1”)
enableHtf2 = input.bool(false, group = group3, inline = “htf2”, title = “”)
htf2 = input.timeframe(“D”, “TF2”, group = group3, inline = “htf2”)
enableHtf3 = input.bool(false, group = group3, inline = “htf3”, title = “”)
htf3 = input.timeframe(“240”, “TF3”, group = group3, inline = “htf3”)
enableHtf4 = input.bool(false, group = group3, inline = “htf4”, title = “”)
htf4 = input.timeframe(“180”, “TF4”, group = group3, inline = “htf4”)
enableHtf5 = input.bool(false, group = group3, inline = “htf5”, title = “”)
htf5 = input.timeframe(“120”, “TF5”, group = group3, inline = “htf5”)
enableHtf6 = input.bool(false, group = group3, inline = “htf6”, title = “”)
htf6 = input.timeframe(“60”, “TF6”, group = group3, inline = “htf6”)
enableHtf7 = input.bool(false, group = group3, inline = “htf7”, title = “”)
htf7 = input.timeframe(“45”, “TF7”, group = group3, inline = “htf7”)
enableHtf8 = input.bool(false, group = group3, inline = “htf8”, title = “”)
htf8 = input.timeframe(“30”, “TF8”, group = group3, inline = “htf8”)
enableHtf9 = input.bool(false, group = group3, inline = “htf9”, title = “”)
htf9 = input.timeframe(“15”, “TF9”, group = group3, inline = “htf9”)supply_color = input.color(color.rgb(242, 54, 69, 0.9), title = ‘Support Zone’, group = ‘Color Settings’, inline = ‘3’)
supply_outline_color = input.color(color.rgb(242, 54, 69, 0.9), title = ‘BoS’, group = ‘Color Settings’, inline = ‘3’)demand_color = input.color(color.rgb(41, 98, 255, 0.9), title = ‘Resistance Zone’, group = ‘Color Settings’, inline = ‘4’)
demand_outline_color = input.color(color.rgb(41, 98, 255, 0.9), title = ‘BoR’, group = ‘Color Settings’, inline = ‘4’)// bos_label_color = input.color(color.white, title = ‘Fracture Zone’, group = ‘Color Settings’, inline = ‘5’)
poi_label_color = input.color(color.white, title = ‘S/R Zone Label’, group = ‘Color Settings’, inline = ‘7’)type zone_with_strength
box zone
int count = 0
string tf// FUNCTION TO ADD NEW AND REMOVE LAST IN ARRAY
array_add_pop(array, new_value_to_add) =>
array.unshift(array, new_value_to_add)
array.pop(array)// FUNCTION MAKE SURE SUPPLY ISNT OVERLAPPING
check_overlapping(new_poi, box_array, atr) =>
atr_threshold = atr * 2
okay_to_draw = truefor i = 0 to array.size(box_array) – 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
top = box.get_top(b)
bottom = box.get_bottom(b)
poi = (top + bottom) / 2upper_boundary = poi + atr_threshold
lower_boundary = poi – atr_thresholdif new_poi >= lower_boundary and new_poi <= upper_boundary okay_to_draw := false break else okay_to_draw := true okay_to_draw // FUNCTION TO DRAW SUPPLY OR DEMAND ZONE support_resistance(value_array, bn_array, box_array, label_array, count_array, box_type, atr, tf_label, tfbarindex, is_htf) =>
atr_buffer = atr * (box_width / 10)
box_left = is_htf ? bar_index : array.get(bn_array, 0)
box_right = bar_indexvar float box_top = 0.00
var float box_bottom = 0.00
var float poi = 0.00if box_type == 1
box_top := array.get(value_array, 0)
box_bottom := box_top – atr_buffer
poi := (box_top + box_bottom) / 2
else if box_type == -1
box_bottom := array.get(value_array, 0)
box_top := box_bottom + atr_buffer
poi := (box_top + box_bottom) / 2okay_to_draw = check_overlapping(poi, box_array, atr)
// okay_to_draw = true
//delete oldest box, and then create a new box and add it to the array
if box_type == 1 and okay_to_draw
zone_with_strength last = array.get(box_array, array.size(box_array) – 1)
if not na(last)
box.delete(last.zone)
box b = box.new(left = box_left, top = box_top, right = bar_index, bottom = box_bottom, border_color = supply_outline_color,
bgcolor = color.new(supply_color, 80), extend = extend.none, text = tf_label, text_halign = text.align_right, text_valign = text.align_center, text_color = poi_label_color, text_size = size.small, xloc = xloc.bar_index)
zone_with_strength zws = zone_with_strength.new(b, 0, tf_label)
array_add_pop(box_array, zws)else if box_type == -1 and okay_to_draw
zone_with_strength last = array.get(box_array, array.size(box_array) – 1)
if not na(last)
box.delete(last.zone)
box b = box.new(left = box_left, top = box_top, right = bar_index, bottom = box_bottom, border_color = demand_outline_color,
bgcolor = color.new(demand_color, 80), extend = extend.none, text = tf_label, text_halign = text.align_right, text_valign = text.align_center, text_color = poi_label_color, text_size = size.small, xloc = xloc.bar_index)
zone_with_strength zws = zone_with_strength.new(b, 0, tf_label)
array_add_pop(box_array, zws)// FUNCTION TO CHANGE SUPPLY/DEMAND TO A BOS IF BROKEN
sd_to_bos(box_array, bos_array, count_array, label_array, zone_type, tfclose, tfbarindex) =>
for i = 0 to array.size(box_array) – 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
level_to_break_top = box.get_top(b)
level_to_break_bottom = box.get_bottom(b)
// if ta.crossover(close, level_to_break)
if (zone_type == 1 and close >= level_to_break_top) or (zone_type == -1 and close <= level_to_break_bottom) copied_zone = zone_with_strength.copy(zws) box cz = copied_zone.zone mid = (box.get_top(b) + box.get_bottom(b)) / 2 line bosline = line.new(box.get_left(cz), mid, bar_index, mid, xloc.bar_index, extend.none, zone_type == 1 ? supply_outline_color : demand_outline_color, line.style_dotted) array_add_pop(bos_array, bosline) // box bos = array.get(bos_array, 0) // box.set_top(bos, mid) // box.set_bottom(bos, mid) // box.set_right(bos, bar_index) // box.set_extend(bos, extend.none) // box.set_text(bos, '') // box.set_text_color( bos, bos_label_color) // box.set_text_size(bos, size.small) // box.set_text_halign(bos, text.align_center) // box.set_text_valign(bos, text.align_center) box.delete(b) array.set(box_array, i, na) // array.remove(box_array, i) // box.delete(array.get(label_array, i)) // FUNCTION MANAGE CURRENT BOXES BY CHANGING ENDPOINT extend_box_endpoint(box_array, count_array, tfbarindex, tfhigh, tflow) =>
for i = 0 to array.size(box_array) – 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
top = box.get_top(b)
bottom = box.get_bottom(b)
count = zws.count
if (high[swing_length – 1] >= bottom and high[swing_length – 1] <= top) or (low[swing_length - 1] >= bottom and low[swing_length – 1] <= top) count := count + 1 zws.count := count // count := count + 1 // zws.count := count box.set_right(b, bar_index + 40) box.set_text(b, str.format("{0} / {1}", count, zws.tf)) zws.zone := b array.set(box_array, i, zws) // //END FUNCTIONS // // // CALCULATIONS FOR SUPPORT AND RESISTANCE // calculateSR(swing_high_values, swing_low_values, swing_high_bns, swing_low_bns, supply_zone, demand_zone, current_supply_touch_count, current_demand_touch_count, current_supply_poi, current_demand_poi, supply_bos, demand_bos, series1, series2, tf_label, tfbarindex, tfclose, atr, is_htf, swing_high, swing_low, swing_index) =>
// NEW SWING HIGH
if not na(swing_high)//MANAGE SWING HIGH VALUES
array_add_pop(swing_high_values, swing_high)
array_add_pop(swing_high_bns, swing_index)support_resistance(swing_high_values, swing_high_bns, supply_zone, current_supply_poi, current_supply_touch_count, 1, atr, tf_label, tfbarindex, is_htf)
// NEW SWING LOW
else if not na(swing_low)//MANAGE SWING LOW VALUES
array_add_pop(swing_low_values, swing_low)
array_add_pop(swing_low_bns, swing_index)support_resistance(swing_low_values, swing_low_bns, demand_zone, current_demand_poi, current_demand_touch_count, -1, atr, tf_label, tfbarindex, is_htf)
sd_to_bos(supply_zone, supply_bos, current_supply_touch_count, current_supply_poi, 1, tfclose, tfbarindex)
sd_to_bos(demand_zone, demand_bos, current_demand_touch_count, current_demand_poi, -1, tfclose, tfbarindex)extend_box_endpoint(supply_zone, current_supply_touch_count, tfbarindex, series1, series2)
extend_box_endpoint(demand_zone, current_demand_touch_count, tfbarindex, series1, series2)var swing_high_values = array.new_float(5,0.00)
var swing_low_values = array.new_float(5,0.00)var swing_high_bns = array.new_int(5,0)
var swing_low_bns = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi = array.new_box(history_of_demand_to_keep, na)var supply_zones = array.new
(history_of_demand_to_keep, na)
var demand_zones = array.new(history_of_demand_to_keep, na) var touches_for_supply = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR BOS
var supply_bos = array.new_line(5, na)
var demand_bos = array.new_line(5, na)var swing_high_values1 = array.new_float(5,0.00)
var swing_low_values1 = array.new_float(5,0.00)var swing_high_bns1 = array.new_int(5,0)
var swing_low_bns1 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones1 = array.new(history_of_demand_to_keep, na)
var demand_zones1 = array.new(history_of_demand_to_keep, na) var touches_for_supply1 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand1 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi1 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi1 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos1 = array.new_line(5, na)
var demand_bos1 = array.new_line(5, na)var swing_high_values2 = array.new_float(5,0.00)
var swing_low_values2 = array.new_float(5,0.00)var swing_high_bns2 = array.new_int(5,0)
var swing_low_bns2 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones2 = array.new(history_of_demand_to_keep, na)
var demand_zones2 = array.new(history_of_demand_to_keep, na) var touches_for_supply2 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand2 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi2 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi2 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos2 = array.new_line(5, na)
var demand_bos2 = array.new_line(5, na)var swing_high_values3 = array.new_float(5,0.00)
var swing_low_values3 = array.new_float(5,0.00)var swing_high_bns3 = array.new_int(5,0)
var swing_low_bns3 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones3 = array.new(history_of_demand_to_keep, na)
var demand_zones3 = array.new(history_of_demand_to_keep, na) var touches_for_supply3 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand3 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi3 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi3 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos3 = array.new_line(5, na)
var demand_bos3 = array.new_line(5, na)var swing_high_values4 = array.new_float(5,0.00)
var swing_low_values4 = array.new_float(5,0.00)var swing_high_bns4 = array.new_int(5,0)
var swing_low_bns4 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones4 = array.new(history_of_demand_to_keep, na)
var demand_zones4 = array.new(history_of_demand_to_keep, na) var touches_for_supply4 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand4 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi4 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi4 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos4 = array.new_line(5, na)
var demand_bos4 = array.new_line(5, na)var swing_high_values5 = array.new_float(5,0.00)
var swing_low_values5 = array.new_float(5,0.00)var swing_high_bns5 = array.new_int(5,0)
var swing_low_bns5 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones5 = array.new(history_of_demand_to_keep, na)
var demand_zones5 = array.new(history_of_demand_to_keep, na) var touches_for_supply5 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand5 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi5 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi5 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos5 = array.new_line(5, na)
var demand_bos5 = array.new_line(5, na)var swing_high_values6 = array.new_float(5,0.00)
var swing_low_values6 = array.new_float(5,0.00)var swing_high_bns6 = array.new_int(5,0)
var swing_low_bns6 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones6 = array.new(history_of_demand_to_keep, na)
var demand_zones6 = array.new(history_of_demand_to_keep, na) var touches_for_supply6 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand6 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi6 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi6 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos6 = array.new_line(5, na)
var demand_bos6 = array.new_line(5, na)var swing_high_values7 = array.new_float(5,0.00)
var swing_low_values7 = array.new_float(5,0.00)var swing_high_bns7 = array.new_int(5,0)
var swing_low_bns7 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones7 = array.new(history_of_demand_to_keep, na)
var demand_zones7 = array.new(history_of_demand_to_keep, na) var touches_for_supply7 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand7 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi7 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi7 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos7 = array.new_line(5, na)
var demand_bos7 = array.new_line(5, na)var swing_high_values8 = array.new_float(5,0.00)
var swing_low_values8 = array.new_float(5,0.00)var swing_high_bns8 = array.new_int(5,0)
var swing_low_bns8 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones8 = array.new(history_of_demand_to_keep, na)
var demand_zones8 = array.new(history_of_demand_to_keep, na) var touches_for_supply8 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand8 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi8 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi8 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos8 = array.new_line(5, na)
var demand_bos8 = array.new_line(5, na)var swing_high_values9 = array.new_float(5,0.00)
var swing_low_values9 = array.new_float(5,0.00)var swing_high_bns9 = array.new_int(5,0)
var swing_low_bns9 = array.new_int(5,0)// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones9 = array.new(history_of_demand_to_keep, na)
var demand_zones9 = array.new(history_of_demand_to_keep, na) var touches_for_supply9 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand9 = array.new_int(history_of_demand_to_keep, 0)// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi9 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi9 = array.new_box(history_of_demand_to_keep, na)// ARRAYS FOR BOS
var supply_bos9 = array.new_line(5, na)
var demand_bos9 = array.new_line(5, na)atr = ta.atr(50)
if show_current_sr
cur_tf_label = timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period
swing_high = ta.pivothigh(swing_length, swing_length)
swing_low = ta.pivotlow(swing_length, swing_length)
swing_index = bar_index[swing_length]
calculateSR(swing_high_values, swing_low_values, swing_high_bns, swing_low_bns, supply_zones, demand_zones, touches_for_supply, touches_for_demand, current_supply_poi, current_demand_poi, supply_bos, demand_bos, high, low, cur_tf_label, bar_index, close, atr, false, swing_high, swing_low, swing_index)// SUPPORT / RESISTANCE FOR HTF1
[high1, low1, close1, barindex1, atr1, timeframe1, swing_high1, swing_low1, swing_index1] = request.security(syminfo.tickerid, htf1, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF2
[high2, low2, close2, barindex2, atr2, timeframe2, swing_high2, swing_low2, swing_index2] = request.security(syminfo.tickerid, htf2, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF3
[high3, low3, close3, barindex3, atr3, timeframe3, swing_high3, swing_low3, swing_index3] = request.security(syminfo.tickerid, htf3, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF4
[high4, low4, close4, barindex4, atr4, timeframe4, swing_high4, swing_low4, swing_index4] = request.security(syminfo.tickerid, htf4, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF5
[high5, low5, close5, barindex5, atr5, timeframe5, swing_high5, swing_low5, swing_index5] = request.security(syminfo.tickerid, htf5, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF6
[high6, low6, close6, barindex6, atr6, timeframe6, swing_high6, swing_low6, swing_index6] = request.security(syminfo.tickerid, htf6, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF7
[high7, low7, close7, barindex7, atr7, timeframe7, swing_high7, swing_low7, swing_index7] = request.security(syminfo.tickerid, htf7, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF8
[high8, low8, close8, barindex8, atr8, timeframe8, swing_high8, swing_low8, swing_index8] = request.security(syminfo.tickerid, htf8, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])// SUPPORT / RESISTANCE FOR HTF9
[high9, low9, close9, barindex9, atr9, timeframe9, swing_high9, swing_low9, swing_index9] = request.security(syminfo.tickerid, htf9, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, “#.## MIN”) : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index[swing_length]])if enableHtf1 and htf1 != “”
calculateSR(swing_high_values1, swing_low_values1, swing_high_bns1, swing_low_bns1, supply_zones1, demand_zones1, touches_for_supply1, touches_for_demand1, current_supply_poi1, current_demand_poi1, supply_bos1, demand_bos1, high1, low1, timeframe1, barindex1, close1, atr1, true, swing_high1, swing_low1, swing_index1)if enableHtf2 and htf2 != “”
calculateSR(swing_high_values2, swing_low_values2, swing_high_bns2, swing_low_bns2, supply_zones2, demand_zones2, touches_for_supply2, touches_for_demand2, current_supply_poi2, current_demand_poi2, supply_bos2, demand_bos2, high2, low2, timeframe2, barindex2, close2, atr2, true, swing_high2, swing_low2, swing_index2)if enableHtf3 and htf3 != “”
calculateSR(swing_high_values3, swing_low_values3, swing_high_bns3, swing_low_bns3, supply_zones3, demand_zones3, touches_for_supply3, touches_for_demand3, current_supply_poi3, current_demand_poi3, supply_bos3, demand_bos3, high3, low3, timeframe3, barindex3, close3, atr3, true, swing_high3, swing_low3, swing_index3)if enableHtf4 and htf4 != “”
calculateSR(swing_high_values4, swing_low_values4, swing_high_bns4, swing_low_bns4, supply_zones4, demand_zones4, touches_for_supply4, touches_for_demand4, current_supply_poi4, current_demand_poi4, supply_bos4, demand_bos4, high4, low4, timeframe4, barindex4, close4, atr4, true, swing_high4, swing_low4, swing_index4)if enableHtf5 and htf5 != “”
calculateSR(swing_high_values5, swing_low_values5, swing_high_bns5, swing_low_bns5, supply_zones5, demand_zones5, touches_for_supply5, touches_for_demand5, current_supply_poi5, current_demand_poi5, supply_bos5, demand_bos5, high5, low5, timeframe5, barindex5, close5, atr5, true, swing_high5, swing_low5, swing_index5)if enableHtf6 and htf6 != “”
calculateSR(swing_high_values6, swing_low_values6, swing_high_bns6, swing_low_bns6, supply_zones6, demand_zones6, touches_for_supply6, touches_for_demand6, current_supply_poi6, current_demand_poi6, supply_bos6, demand_bos6, high6, low6, timeframe6, barindex6, close6, atr6, true, swing_high6, swing_low6, swing_index6)if enableHtf7 and htf7 != “”
calculateSR(swing_high_values7, swing_low_values7, swing_high_bns7, swing_low_bns7, supply_zones7, demand_zones7, touches_for_supply7, touches_for_demand7, current_supply_poi7, current_demand_poi7, supply_bos7, demand_bos7, high7, low7, timeframe7, barindex7, close7, atr7, true, swing_high7, swing_low7, swing_index7)if enableHtf8 and htf8 != “”
calculateSR(swing_high_values8, swing_low_values8, swing_high_bns8, swing_low_bns8, supply_zones8, demand_zones8, touches_for_supply8, touches_for_demand8, current_supply_poi8, current_demand_poi8, supply_bos8, demand_bos8, high8, low8, timeframe8, barindex8, close8, atr8, true, swing_high8, swing_low8, swing_index8)if enableHtf9 and htf9 != “”
calculateSR(swing_high_values9, swing_low_values9, swing_high_bns9, swing_low_bns9, supply_zones9, demand_zones9, touches_for_supply9, touches_for_demand9, current_supply_poi9, current_demand_poi9, supply_bos9, demand_bos9, high9, low9, timeframe9, barindex9, close9, atr9, true, swing_high9, swing_low9, swing_index9)
10/14/2024 at 11:07 AM #238960Ok, je vais essayer de le traduire. Quoi qu'il en soit, je vois beaucoup de similitudes avec cet autre indicateur : https://www.prorealcode.com/topic/divergences-for-many-indicators-pinescript/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167//---------------------------------------------------------////PRC_Order Blocks and Breaker Blocks//version = 0//30.09.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//---------------------------------------------------------////-----Inputs----------------------------------------------////---------------------------------------------------------//length=10 //Swing LookbackshowBull=5 //Show last bullish OBshowBear=5 //Show last bearish OBuseBody=0showLabels=1 //Show labelslookbackPeriod=300//---------------------------------------------------------////-----Detect Swings---------------------------------------////---------------------------------------------------------//n=barindexonce os=0upper=highest[length](high)lower=lowest[length](low)if high[length]>upper thenos=0elsif low[length]<lower thenos=1elseos=osendifif os=0 and os[1]<>0 thentopy=high[length]topx=barindex[length]topcrossed=0elsif os=1 and os[1]<>1 thenbtmy=low[length]btmx=barindex[length]btmcrossed=0endifif usebody thenmimax=max(close,open)mimin=min(close,open)elsemimax=max(close,open)mimin=min(close,open)endif//---------------------------------------------------------////-----Bullish OB------------------------------------------////---------------------------------------------------------//if close > topy and topcrossed=0 thentopcrossed=1minima=mimax[1]maxima=mimin[1]loc=barindex[1]for i=1 to (n-topx)-1 dominima=min(mimin[i],minima)if minima=mimin[i] thenmaxima=mimax[i]loc=barindex[i]elsemaxima=maximaloc=locendifnext$bullTop[m+1]=maxima$bullBtm[m+1]=minima$bullx[m+1]=loc$bullbreak[m+1]=0m=m+1endif//---------------------------------------------------------////-----Bearish OB------------------------------------------////---------------------------------------------------------//bearBreakConf=0if close < btmy and btmcrossed=0 thenbtmcrossed=1minima2=mimin[1]maxima2=mimax[1]loc2=barindex[1]for i=1 to (n-btmx)-1 domaxima2=max(mimax[i],maxima2)if maxima2=mimax[i] thenminima2=mimin[i]loc2=barindex[i]elseminima2=minima2loc2=loc2endifnext$bearTop[z+1]=maxima2$bearBtm[z+1]=minima2$bearx[z+1]=loc2$bearbreak[z+1]=0z=z+1endif//---------------------------------------------------------////-----Plot Order Blocks-----------------------------------////---------------------------------------------------------//if islastbarupdate thenfor i=m downto 1 dofor j=barindex downto 0 doif barindex[j]>$bullx[i] and close[j] < $bullBtm[i] then$bullright[i]=barindex[j]$bullbreak[i]=1breakelse$bullright[i]=barindexendifnextif i>m-showbull thenif $bullbreak[i]=0 thendrawrectangle($bullx[i],$bullBtm[i],$bullright[i]+20,$bullTop[i])coloured("blue")fillcolor("blue",50)elsif $bullbreak[i]=1 thendrawrectangle($bullx[i],$bullBtm[i],$bullright[i],$bullTop[i])coloured("blue")fillcolor("blue",50)if close>$bullTop[i]thendrawrectangle($bullright[i],$bullBtm[i],barindex+20,$bullTop[i])coloured("green",0)fillcolor("green",50)elsif close<$bullBtm[i]thendrawrectangle($bullright[i],$bullBtm[i],barindex+20,$bullTop[i])coloured("red",0)fillcolor("red",50)elsedrawrectangle($bullright[i],$bullBtm[i],barindex+20,$bullTop[i])coloured("yellow",0)fillcolor("yellow",50)endifendifendifnextfor i=z downto 1 dofor j=barindex downto 0 doif barindex[j]>$bearx[i] and close[j] > $bearTop[i] then$bearright[i]=barindex[j]$bearbreak[i]=1breakelse$bearright[i]=barindexendifnextif i>z-showbear thenif $bearbreak[i]=0 thendrawrectangle($bearx[i],$bearBtm[i],$bearright[i]+20,$bearTop[i])coloured("orange")fillcolor("orange",50)elsif $bearbreak[i]=1 thendrawrectangle($bearx[i],$bearBtm[i],$bearright[i],$bearTop[i])coloured("orange")fillcolor("orange",50)if close>$bearTop[i]thendrawrectangle($bearright[i],$bearBtm[i],barindex+20,$bearTop[i])coloured("green",0)fillcolor("green",50)elsif close<$bearBtm[i]thendrawrectangle($bearright[i],$bearBtm[i],barindex+20,$bearTop[i])coloured("red",0)fillcolor("red",50)elsedrawrectangle($bearright[i],$bearBtm[i],barindex+20,$bearTop[i])coloured("yellow",0)fillcolor("yellow",50)endifendifendifnextendifreturn10/14/2024 at 1:14 PM #238973Voici ce que vous avez :
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182//---------------------------------------------------------////PRC_Protein +//version = 0//14.10.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//---------------------------------------------------------//defparam drawonlastbaronly=true//---------------------------------------------------------////----Inputs----------------------------------------------////---------------------------------------------------------//length=10leftbars=lengthrightbars=lengthsrc1 = lowsrc2 = highboxwidth=5atr=averagetruerange[50](close)//---------------------------------------------------------////-----Calculate Pivots Low--------------------------------////---------------------------------------------------------//if src1 > src1[rightbars] and lowest[rightbars](src1) > src1[rightbars] and src1[rightbars] < lowest[leftbars](src1)[rightbars+1] then$ply[z+1] = src1[rightbars]$plx[z+1] = barindex[rightbars]$crossLow[z+1]=0$Lowrightidx[z+1]=0$atrLow[z+1]=atrz = z + 1endif//---------------------------------------------------------////-----Calculate Pivots High-------------------------------////---------------------------------------------------------//if src2 < src2[rightbars] and highest[rightbars](src2)<src2[rightbars] and src2[rightbars]>highest[leftbars](src2)[rightbars+1] then$phy[t+1]=src2[rightbars]$phx[t+1]=barindex[rightbars]$crossHigh[t+1]=0$Highrightidx[t+1]=0$atrHigh[t+1]=atrt=t+1endif//---------------------------------------------------------////-----Check for broken levels-----------------------------////---------------------------------------------------------//n=barindexif islastbarupdate thenfor i=t downto 1 do//drawpoint($phx[i],$phy[i],2)coloured("blue",50)for j=barindex downto 0 doif barindex[j]>$phx[i] and high[j]>$phy[i] and $crossHigh[i]=0 then$crossHigh[i]=1$Highrightidx[i]=barindex[j]breakendifnextif $crossHigh[i]=1 thendrawsegment($phx[i],$phy[i],$Highrightidx[i],$phy[i])coloured("red")style(dottedline)elsedrawrectangle($phx[i],$phy[i]-0.5*$atrHigh[i]*boxwidth/10,barindex,$phy[i]+0.5*$atrHigh[i]*boxwidth/10)coloured("red",0)fillcolor("red",30)endifnextfor i=z downto 1 do//drawpoint($plx[i],$ply[i],2)coloured("blue",50)for j=barindex downto 0 doif barindex[j]>$plx[i] and low[j]<$ply[i] and $crossLow[i]=0 then$crossLow[i]=1$Lowrightidx[i]=barindex[j]breakendifnextif $crossLow[i]=1 thendrawsegment($plx[i],$ply[i],$Lowrightidx[i],$ply[i])coloured("blue")style(dottedline)elsedrawrectangle($plx[i],$ply[i]-0.5*$atrLow[i]*boxwidth/10,barindex,$ply[i]+0.5*$atrLow[i]*boxwidth/10)coloured("blue",0)fillcolor("blue",30)endifnextendifreturn10/14/2024 at 4:51 PM #238986 -
AuthorPosts
Find exclusive trading pro-tools on