INVITE-ONLY SCRIPT
MandarKalgutkar-Buy/Sell Arrow Signal

//version=5
indicator("MandarKalgutkar-Buy/Sell Arrow Signal", overlay=true)
ma = ta.sma(close, 21)
rsi = ta.rsi(close, 14)
// Tracking variables
var float buyRefHigh = na
var float sellRefLow = na
var int buyCandleIndex = na
var int sellCandleIndex = na
// Detect initial breakout candle
bullishBreak = close > open and close > ma and close[1] < ma[1]
if bullishBreak
buyRefHigh := high
buyCandleIndex := bar_index
bearishBreak = close < open and close < ma and close[1] > ma[1]
if bearishBreak
sellRefLow := low
sellCandleIndex := bar_index
// Next candle only: ensure current bar is exactly next one
isNextBuyBar = (not na(buyCandleIndex)) and bar_index == buyCandleIndex + 1
isNextSellBar = (not na(sellCandleIndex)) and bar_index == sellCandleIndex + 1
// Buy/sell logic
buySignal = isNextBuyBar and high > buyRefHigh and rsi > 55
sellSignal = isNextSellBar and low < sellRefLow and rsi < 45
// Reset if signal used or next candle missed
if buySignal or isNextBuyBar
buyRefHigh := na
buyCandleIndex := na
if sellSignal or isNextSellBar
sellRefLow := na
sellCandleIndex := na
// Plot
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, size=size.small)
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, size=size.small)
plot(ma, "20 MA", color.orange)
indicator("MandarKalgutkar-Buy/Sell Arrow Signal", overlay=true)
ma = ta.sma(close, 21)
rsi = ta.rsi(close, 14)
// Tracking variables
var float buyRefHigh = na
var float sellRefLow = na
var int buyCandleIndex = na
var int sellCandleIndex = na
// Detect initial breakout candle
bullishBreak = close > open and close > ma and close[1] < ma[1]
if bullishBreak
buyRefHigh := high
buyCandleIndex := bar_index
bearishBreak = close < open and close < ma and close[1] > ma[1]
if bearishBreak
sellRefLow := low
sellCandleIndex := bar_index
// Next candle only: ensure current bar is exactly next one
isNextBuyBar = (not na(buyCandleIndex)) and bar_index == buyCandleIndex + 1
isNextSellBar = (not na(sellCandleIndex)) and bar_index == sellCandleIndex + 1
// Buy/sell logic
buySignal = isNextBuyBar and high > buyRefHigh and rsi > 55
sellSignal = isNextSellBar and low < sellRefLow and rsi < 45
// Reset if signal used or next candle missed
if buySignal or isNextBuyBar
buyRefHigh := na
buyCandleIndex := na
if sellSignal or isNextSellBar
sellRefLow := na
sellCandleIndex := na
// Plot
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, size=size.small)
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, size=size.small)
plot(ma, "20 MA", color.orange)
僅限邀請腳本
只有經作者授權的使用者才能訪問此腳本,且通常需付費。您可以將此腳本加入收藏,但需先向作者申請並獲得許可後才能使用 — 點擊此處了解更多。如需更多詳情,請依照作者說明或直接聯繫Mandar_1980。
除非您完全信任其作者並了解腳本的工作原理,否則TradingView不建議您付費或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Mandar Kalgutkar
提醒:在請求訪問權限之前,請閱讀僅限邀請腳本指南。
mandar k
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
僅限邀請腳本
只有經作者授權的使用者才能訪問此腳本,且通常需付費。您可以將此腳本加入收藏,但需先向作者申請並獲得許可後才能使用 — 點擊此處了解更多。如需更多詳情,請依照作者說明或直接聯繫Mandar_1980。
除非您完全信任其作者並了解腳本的工作原理,否則TradingView不建議您付費或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Mandar Kalgutkar
提醒:在請求訪問權限之前,請閱讀僅限邀請腳本指南。
mandar k
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。