OPEN-SOURCE SCRIPT
Mikey’s Strategy (AutoEMA+)

⚙️ Core Idea:
A long-only EMA crossover strategy that automatically selects the optimal EMA length (5–25) based on historical performance using a custom scoring system.
🎯 Entry Conditions:
Price crosses above the selected EMA.
(Optional) Price is above HTF EMA200 (higher timeframe trend).
(Optional) ADX is above a minimum threshold.
(Optional) Volume is above average × multiplier.
A cooldown period has passed since the last exit.
❌ Exit Condition:
Price closes fully below the EMA (current candle: high, low, and close all below),
and the previous candle was above or touched the EMA.
🧠 Auto EMA Selection Logic:
Scans EMAs in the range (e.g., 8–21) every N bars.
Scores each EMA based on:
Time price spent above the EMA
Respect for EMA (touches)
Trend consistency
Distance from EMA (when above)
Picks the EMA with the highest valid score, and updates only if it’s significantly better.
🛡️ Risk Management:
No pyramiding (1 position max).
Cooldown period after exit.
No hard stop loss or take profit.
📊 Visuals & Alerts:
Plots the selected EMA and optional HTF EMA200.
Entry markers and info label on the chart.
Alerts for valid entries and filtered signals.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.