OPEN-SOURCE SCRIPT

sell & buy indicator for BEHRAD

//version=5
indicator("اندیکاتور خرید و فروش", overlay=true)

// تنظیمات
rsiPeriod = input(14, title="دوره RSI")
rsiOverbought = input(70, title="اشباع خرید (Overbought)")
rsiOversold = input(30, title="اشباع فروش (Oversold)")
shortMA = input(9, title="میانگین متحرک کوتاه‌مدت")
longMA = input(21, title="میانگین متحرک بلندمدت")

// محاسبات
rsi = ta.rsi(close, rsiPeriod)
shortMAValue = ta.sma(close, shortMA)
longMAValue = ta.sma(close, longMA)

// سیگنال‌ها
buySignal = rsi < rsiOversold and shortMAValue > longMAValue
sellSignal = rsi > rsiOverbought and shortMAValue < longMAValue

// ترسیم نقاط خرید و فروش
plotshape(buySignal, title="خرید", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
plotshape(sellSignal, title="فروش", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")

// میانگین‌ها
plot(shortMAValue, color=color.blue, title="میانگین کوتاه‌مدت")
plot(longMAValue, color=color.orange, title="میانگین بلندمدت")
Bands and ChannelsBill Williams IndicatorsCandlestick analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer