OPEN-SOURCE SCRIPT

moh1

43
//version=6
indicator("moh1", overlay=true)

// === الإعدادات ===
length = input.int(20, title="عدد الشموع (حساسية الاتجاه)")
src = input.source(close, title="مصدر السعر")
maType = input.string("EMA", title="نوع المتوسط", options=["EMA", "SMA"])

// الألوان
colorUp = input.color(color.green, title="لون الاتجاه الصاعد")
colorDown = input.color(color.red, title="لون الاتجاه الهابط")
colorSide = input.color(color.yellow, title="لون الاتجاه العرضي")
sensitivity = input.float(0.1, title="حساسية الاتجاه العرضي (%)", minval=0.01)

// === حساب المتوسط ===
ma = maType == "EMA" ? ta.ema(src, length) : ta.sma(src, length)

// === تحليل الاتجاه ===
ma_slope = ma - ma[1]
slope_pct = ma_slope / ma[1] * 100

trendColor = slope_pct > sensitivity ? colorUp :
slope_pct < -sensitivity ? colorDown :
colorSide

// === رسم الخط المتغير اللون ===
plot(ma, title="خط الاتجاه", color=trendColor, linewidth=2)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.