OPEN-SOURCE SCRIPT

Livelli Sensibili Orizzontali

110
//version=5
indicator("Livelli Sensibili Orizzontali", overlay=true)

// Funzione per trovare massimi/minimi SOLAMENTE sui punti più alti e più bassi raggiunti con almeno 3 candele decrescenti o crescenti dopo o prima
isSwingHigh(src) =>
ta.highestbars(src, 4) == 0 and high[1] < high and high[2] < high and high[3] < high and ta.valuewhen(high == ta.highest(high, 10), high, 0) == high

isSwingLow(src) =>
ta.lowestbars(src, 4) == 0 and low[1] > low and low[2] > low and low[3] > low and ta.valuewhen(low == ta.lowest(low, 10), low, 0) == low

// Identificazione dei livelli sensibili
var float lastHigh = na
var float lastLow = na

if isSwingHigh(high)
lastHigh := high
if isSwingLow(low)
lastLow := low

// Disegna linee orizzontali SOLO sui massimi e minimi effettivi
line.new(x1=bar_index[3], y1=lastHigh, x2=bar_index, y2=lastHigh, width=2, color=color.red)
line.new(x1=bar_index[3], y1=lastLow, x2=bar_index, y2=lastLow, width=2, color=color.green)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.