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)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。