//@version=4
study("macd",overlay=true)
fastma= ema(close,34)
slowma= ema(close,89)
macd =((fastma + slowma)/2)
signal = sma(macd,9)
below = ema(close,200)
///highes and slowes
higha = highest(high,100)
slowa = lowest(low,100)
// rsi
rsisource = input(title="RSI Source",type=input.source,defval=close)
rsilength = input(title="RSI Length",type=input.integer,defval=14)
rsiOB = input(title="RSI Overbought Level",type=input.integer,defval=68)
rsiOS = input(title="RSI Oversold Level",type=input.integer,defval=34)
rsia = rsi(rsisource,rsilength)
rsiB = rsia >= rsiOB
rsiS = rsia <= rsiOS
bullaa = close > open and close < open
bearaa = close < open and close > open
trade = ((rsiB or rsiB) and bearaa) or ((rsiS or rsiS) and bullaa)
//////////////
entry_long=crossover(macd,signal)
entry_price_long=valuewhen(entry_long,close,0)
entry_short=crossover(signal,macd)
entry_price_short=valuewhen(entry_short,close,0)

plotshape(entry_long and entry_price_long,title="long",location=location.abovebar,style=shape.triangleup,color=color.green,text="long")
plotshape(entry_short and entry_price_short,title="short",location=location.belowbar,style=shape.triangledown,color=color.red,text="short")
plot(macd,color=color.green,linewidth=2)
plot(signal,color=color.red,linewidth=2)
plot(below,color=color.yellow,linewidth=2)
plot(higha,color=color.green)
plot(slowa,color=color.red)

plotshape (trade and bearaa,title="long",location=location.abovebar,textcolor=color.white,transp=0,style=shape.triangledown,color=color.red,text="short")
plotshape (trade and bullaa,title="short",location=location.belowbar,textcolor=color.white,transp=0,style=shape.triangleup,color=color.red,text="long")
إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.