Quelqu'un peut m'aider à télécharger le code de l'indicateur ci-dessous.
indicator('Breakout]', overlay = true, max_lines_count = 4, max_labels_count = 500)
// INPUTS --------------------------------------------------------------------------------------------------------{
int length = 100 // Longueur de l'extension de la ligne
float multi = input.float(4, 'Channel Width', step = 0.1) // Multiplicateur pour la largeur du canal
bool show_x = input.bool(false, "Show X signals")
bool filter_sig = input.bool(false, "Filter Signals by Trends", "If True indicator filters ▲▼ based on channels breakout condition. Si le canal est haussier avec un cercle vert seulement ▲ affiché si baissier avec rouge seulement ▼ signaux affichés")
color color1 = input.color(#1dac70, "", inline = "col", group = "OB/OS")
color color3 = input.color(#df3a79, "", inline = "col", group = "OB/OS")
bool gradient = input.bool(true, "Gradient", inline = "ll", group = "OB/OS")
int transp = input.int(80, "", inline = "ll", group = "OB/OS")
color color2 = chart.fg_color // Couleur de la ligne médiane
// Initialisation des variables
var float value = na
var float value_upper = na
var float value_lower = na
var float value_upper_mid = na
var float value_lower_mid = na
var bool trend = false
var count = 0
// }
// CALCULATIONS----------------------------------------------------------------------------------------------{
float atr = ta.sma(ta.atr(200), 100) * multi // Largeur du canal basée sur l'ATR
// Initialisation des valeurs des canaux
si bar_index == 301
valeur := hl2
value_upper := hl2 + atr
valeur_inférieure := hl2 - atr
valeur_moyenne_supérieure := math.avg(valeur, valeur_supérieure)
valeur_moyenne_inférieure := math.avg(valeur, valeur_inférieure)
valeur_moyenne_inférieure
// Vérifier les croisements
bool cross_upper = ta.crossover(low, value_upper) and barstate.isconfirmed
bool cross_lower = ta.crossunder(high, value_lower) and barstate.isconfirmed
// Compter les barres en dehors du canal
si low > value_upper ou high < value_lower
count := count + 1
compter
// Réinitialiser les valeurs des canaux lors du croisement ou après 100 mesures
if cross_upper or cross_lower or count == 100
compte := 0
valeur := hl2
value_upper := hl2 + atr
valeur_inférieure := hl2 - atr
valeur_moyenne_supérieure := math.avg(valeur, valeur_supérieure)
valeur_moyenne_inférieure := math.avg(valeur, valeur_inférieure)
valeur_moyenne_inférieure
bool chage = not(valeur != valeur[1])
bool buy_ = ta.crossover(low, value_lower_mid) and low[10] > value_lower_mid and barstate.isconfirmed and chage
bool sell_ = ta.crossunder(high, value_upper_mid) and high[10] < value_upper_mid and barstate.isconfirmed and chage
bool fakeout_up = ta.crossunder(high, value_upper) and barstate.isconfirmed and chage
bool fakeout_dn = ta.crossover(low, value_lower) and barstate.isconfirmed and chage
// }
// PLOT ------------------------------------------------------------------------------------------------------------{
// Tracer et remplir des lignes
p1 = plot(value_upper != value_upper[1] ? na : value_upper, color = color1, linewidth = 1, style = plot.style_linebr)
p0 = plot(bar_index % 2 == 0 ? value : na, color = color2, style = plot.style_linebr)
p2 = plot(valeur_inférieure != valeur_inférieure[1] ? na : valeur_inférieure, color = color3, linewidth = 1, style = plot.style_linebr)
upper_mid = math.avg(value_upper, value)
lower_mid = math.avg(value_lower, value)
p01 = plot(upper_mid != upper_mid[1] ? na : upper_mid, color = color.new(color2, 50), style = plot.style_linebr)
p02 = plot(lower_mid != lower_mid[1] ? na : lower_mid, color = color.new(color2, 50), style = plot.style_linebr)
fill(p1, p01, value_upper, value, color.new(value_upper != value_upper[1] ? na : color1, transp), color.new(value_upper != value_upper[1] ? na : color1, gradient ? 100 : transp))
fill(p2, p02, value, value_lower, color.new(value_upper != value_upper[1] ? na : color3, gradient ? 100 : transp), color.new(value_upper != value_upper[1] ? na : color3, transp))
// Tracer les signaux croisés
si cross_upper
trend := true
label.new(bar_index - 1, value_upper[1], text = '⦿', textcolor = color1, style = label.style_label_center, color = color(na), size = size.large, tooltip = "Bullish Break")
if cross_lower
trend := false
label.new(bar_index - 1, value_lower[1], text = '⦿', textcolor = color3, style = label.style_label_center, color = color(na), size = size.large, tooltip = "Bearish Break")
if buy_ and (filter_sig ? trend : true)
label.new(bar_index - 1, low[1], text = '▲', textcolor = color1, style = label.style_label_up, color = color(na), size = size.normal)
if sell_ and (filter_sig ? not trend : true)
label.new(bar_index - 1, high[1], text = '▼', textcolor = color3, style = label.style_label_down, color = color(na), size = size.normal)
si fakeout_up et show_x
label.new(bar_index - 1, high[1], text = 'X', textcolor = color3, style = label.style_label_down, color = color(na), size = size.normal)
si fakeout_dn et show_x
label.new(bar_index - 1, low[1], text = 'X', textcolor = color1, style = label.style_label_up, color = color(na), size = size.normal)
// }