فيما يلي مجموعة من السكربتات (الشيفرات) الخاصة بخمس مؤشرات مبتكرة، وهي أمثلة مبسطة باستخدام Pine Script (نسخة 5) لمنصة TradingView. أُذكّر بأن هذه السكربتات تُقدَّم لأغراض تعليمية وتجريبية، وقد تحتاج إلى تعديل وتحسين قبل استخدامها في التداول الواقعي.
1. مؤشر الاتجاه الذكي (Smart Trend Indicator)
يستخدم هذا المؤشر حساب ATR لتحديد نطاقات الدعم والمقاومة الديناميكية، ويتم اعتمادها لتحديد الاتجاه؛ حيث يُرسم خط أخضر في حالة الاتجاه الصعودي وخط أحمر في حالة الاتجاه الهبوطي.
//@version=5
indicator("Smart Trend Indicator", overlay=true, shorttitle="STI")
// الإعدادات
atrLength = input.int(10, title="ATR Length", minval=1)
atrFactor = input.float(3.0, title="ATR Factor", step=0.1)
// حساب ATR
atrValue = ta.atr(atrLength)
// الحسابات الأساسية للمستويات
basicUpper = (high + low) / 2 + atrFactor * atrValue
basicLower = (high + low) / 2 - atrFactor * atrValue
// تحديد المستويات النهائية بناءً على الشروط السابقة
var float finalUpper = na
var float finalLower = na
finalUpper := na(finalUpper[1]) ? basicUpper : (close[1] > finalUpper[1] ? math.min(basicUpper, finalUpper[1]) : basicUpper)
finalLower := na(finalLower[1]) ? basicLower : (close[1] < finalLower[1] ? math.max(basicLower, finalLower[1]) : basicLower)
// تحديد الاتجاه
var int trend = 1
trend := nz(trend[1], 1)
trend := close > finalUpper[1] ? 1 : close < finalLower[1] ? -1 : trend
// رسم الخط الذي يمثل الاتجاه
plot(trend == 1 ? finalLower : finalUpper, title="Trend Line", color=trend == 1 ? color.green : color.red, linewidth=2)
==================================
. مؤشر تدفق الأموال المحسن (Enhanced Money Flow Index – EMFI)
هذا السكربت يُعدّل على مؤشر تدفق الأموال التقليدي من خلال استخدام دالة (RMA) لتنعيم التدفقات المالية، مما يعطي مؤشراً أكثر حساسية للتغيرات في التدفقات الشرائية والبيعية.
//@version=5
indicator("Enhanced Money Flow Index (EMFI)", shorttitle="EMFI", overlay=false)
// الإعدادات
length = input.int(14, title="Length", minval=1)
// حساب السعر المتوسط
typical = (high + low + close) / 3
// حساب التدفق المالي
moneyFlow = typical * volume
// حساب التدفقات المالية الإيجابية والسلبية مع التنعيم
posFlow = ta.rma(ta.change(typical) > 0 ? moneyFlow : 0, length)
negFlow = ta.rma(ta.change(typical) < 0 ? moneyFlow : 0, length)
// حساب النسبة
ratio = posFlow / (negFlow + 1e-10) // لتفادي القسمة على صفر
// حساب مؤشر EMFI
emfi = 100 - (100 / (1 + ratio))
// الرسم
plot(emfi, title="EMFI", color=color.blue)
hline(80, "Overbought", color=color.green)
hline(20, "Oversold", color=color.red)
. مؤشر تقلبات التكيّف (Adaptive Volatility Oscillator)
يهدف هذا المؤشر إلى قياس التغير السعري بالنسبة لمستوى التقلب باستخدام ATR ويسعى إلى تعديل الإعدادات بشكل متكيف مع تقلبات السوق.
//@version=5
indicator("Adaptive Volatility Oscillator", overlay=false)
// الإعدادات
length = input.int(14, title="Smoothing Length", minval=1)
atrPeriod = input.int(14, title="ATR Period", minval=1)
// حساب ATR
atrValue = ta.atr(atrPeriod)
// حساب المتوسط البسيط للسعر
basis = ta.sma(close, length)
// حساب الفرق بين السعر والمتوسط
diff = close - basis
// معامل التكيّف، يتم تقسيم الفرق على ATR لتطبيع الحركة
adapt = diff / (atrValue + 1e-10)
// تطبيق تنعيم على معامل التكيّف
oscillator = 100 * ta.ema(adapt, length) // ضرب بـ100 للتوسيع
// الرسم
plot(oscillator, title="Adaptive Volatility Oscillator", color=color.purple)
hline(0, "Zero Line", color=color.gray)
============================
. مؤشر القوة الديناميكية (Dynamic Strength Index – DSI)
هذا المؤشر يُعدل على مؤشر القوة النسبية (RSI) من خلال دمج عامل تقلب (ATR) لتعديل التنعيم، في محاولة لجعل المؤشر أكثر ديناميكية واستجابة للتغيرات في السوق.
//@version=5
indicator("Dynamic Strength Index (DSI)", shorttitle="DSI", overlay=false)
// الإعدادات
length = input.int(14, title="RSI Length", minval=1)
atrSource = input.int(14, title="ATR Length", minval=1)
// حساب التغيرات السعرية
delta = ta.change(close)
gain = math.max(delta, 0)
loss = math.max(-delta, 0)
// حساب ATR لتضمينه في عامل التنعيم
atrVol = ta.atr(atrSource)
// تعديل معاملة التنعيم بناءً على التقلب النسبي (مثال توضيحي)
smoothGain = ta.ema(gain, length) * (1 + atrVol / 100)
smoothLoss = ta.ema(loss, length) * (1 + atrVol / 100)
// حساب نسبة القوة (RS) ومؤشر DSI
rs = smoothGain / (smoothLoss + 1e-10)
dsi = 100 - (100 / (1 + rs))
// الرسم
plot(dsi, title="Dynamic Strength Index", color=color.orange)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
=======================================
مؤشر الانعكاس الذكي (Smart Reversal Indicator)
يعتمد هذا المؤشر على مراقبة تقاطعات المتوسطات المتحركة قصيرة وطويلة الأجل لتحديد نقاط انعكاس محتملة في اتجاه السعر.
//@version=5
indicator("Smart Reversal Indicator", overlay=true, shorttitle="SRI")
// إعدادات المتوسطات المتحركة
shortLength = input.int(9, title="Short MA Length", minval=1)
longLength = input.int(21, title="Long MA Length", minval=1)
// حساب المتوسطات المتحركة البسيطة للسعر
shortMA = ta.sma(close, shortLength)
longMA = ta.sma(close, longLength)
// إشارات الانعكاس: تقاطع الصعود والهبوط
bullSignal = ta.crossover(shortMA, longMA)
bearSignal = ta.crossunder(shortMA, longMA)
// رسم المتوسطات
plot(shortMA, title="Short MA", color=color.blue)
plot(longMA, title="Long MA", color=color.red)
// رسم إشارات الشراء والبيع على الشارت
plotshape(bullSignal, title="Bullish Reversal", location=location.belowbar, color=color.green, style=shape.arrowup, size=size.tiny, text="Buy")
plotshape(bearSignal, title="Bearish Reversal", location=location.abovebar, color=color.red, style=shape.arrowdown, size=size.tiny, text="Sell")