1 احصل على هذا الرسم احصل على هذا الرسم 2 2 //+------------------------------------------------------------------+ //| RSI and Moving Average EA | //+------------------------------------------------------------------+ #property strict input int rsi_period = 14; // Period for RSI input int ma_period = 14; // Period for Moving Average double CalculateRSI(int period); double CalculateMA(int period); //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Cleanup } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double rsi = CalculateRSI(rsi_period); double ma = CalculateMA(ma_period); // Example: Buy signal if RSI < 30 and price above MA if(rsi < 30 && Close[1] > ma) { // Buy logic here } // Example: Sell signal if RSI > 70 and price below MA if(rsi > 70 && Close[1] < ma) { // Sell logic here } } //+------------------------------------------------------------------+ //| Function to calculate RSI | //+------------------------------------------------------------------+ double CalculateRSI(int period) { double rsi = iRSI(_Symbol, _Period, period, PRICE_CLOSE, 0); return(rsi); } //+------------------------------------------------------------------+ //| Function to calculate Moving Average | //+------------------------------------------------------------------+ double CalculateMA(int period) { double ma = iMA(_Symbol, _Period, period, 0, MODE_SMA, PRICE_CLOSE, 0); return(ma); }
إخلاء المسؤولية لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في
شروط الاستخدام .