OPEN-SOURCE SCRIPT

13 EMA Cross - Next Day High/Low

//version=6
indicator("13 EMA Cross - Next Day High/Low", overlay=true)

// Inputs for EMAs
length1 = input.int(13, title="Short EMA (13 EMA)")
length2 = input.int(34, title="Long EMA (34 EMA)")

// Input for support line properties
supportColor = input.color(#A52A2A, title="Support Line Color") // Brown color
lineWidth = input.int(2, title="Line Width")

// Calculate EMAs
ema13 = ta.ema(close, length1)
ema34 = ta.ema(close, length2)

// Detect Crosses
crossAbove = ta.crossover(ema13, ema34)
crossBelow = ta.crossunder(ema13, ema34)

// Track when a crossover happens
var float nextDayHigh = na
var float nextDayLow = na
var int crossoverBarIndex = na

if crossAbove or crossBelow
crossoverBarIndex := bar_index
nextDayHigh := na
nextDayLow := na

// Capture next day candle's high and low after crossover
if bar_index == crossoverBarIndex + 1
nextDayHigh := high
nextDayLow := low

// Draw horizontal lines at the next day's high and low
if not na(nextDayHigh) and not na(nextDayLow)
line.new(x1=crossoverBarIndex + 1, y1=nextDayHigh, x2=bar_index, y2=nextDayHigh, color=supportColor, width=lineWidth)
line.new(x1=crossoverBarIndex + 1, y1=nextDayLow, x2=bar_index, y2=nextDayLow, color=supportColor, width=lineWidth)
Candlestick analysisChart patternsMoving Averages

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明