'MA200' - unexpected token - page 3

 


//  Can you help me please



//+------------------------------------------------------------------+

//|                                            MovingAverageExpert.mq4|
//|                        Copyright 2024, MetaQuotes Software Corp. |
//|                                             http://www.mql5.com    |
//+------------------------------------------------------------------+
#property strict

input int StopLoss = 50; // وقف الخسارة بالنقاط
input int TakeProfit = 150; // جني الأرباح بالنقاط

//+------------------------------------------------------------------+
//| مؤشرات                                                           |
//+------------------------------------------------------------------+
enum EMAs {
    EMA5 = 5,
    EMA10 = 10,
    EMA200 = 200
};

//+------------------------------------------------------------------+
//| إعدادات الإدخال                                                   |
//+------------------------------------------------------------------+
input double LotSize = 0.1; // حجم الصفقة
input int MagicNumber = 123456; // رقم الصفقة

//+------------------------------------------------------------------+
//| إيقاف استشاري الخبير                                                |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
    Print("Moving Average Expert Advisor is deinitialized, reason = ", reason);
}

//+------------------------------------------------------------------+
//| بدء استشاري الخبير                                                  |
//+------------------------------------------------------------------+
void OnTick()
{
    double EMA5_Value = iMA(_Symbol, 0, EMAs.EMA5, 0, MODE_EMA, PRICE_CLOSE, 0);
    double EMA10_Value = iMA(_Symbol, 0, EMAs.EMA10, 0, MODE_EMA, PRICE_CLOSE, 0);
    double EMA200_Value = iMA(_Symbol, 0, EMAs.EMA200, 0, MODE_EMA, PRICE_CLOSE, 0);

    double current_price = Bid;

    // شرط دخول الصفقة الشرائية
    if (EMA5_Value > EMA10_Value && current_price > EMA200_Value)
    {
        // فتح صفقة شراء
        double stop_loss = current_price - StopLoss * Point;
        double take_profit = current_price + TakeProfit * Point;
        int ticket = OrderSend(_Symbol, OP_BUY, LotSize, current_price, 3, stop_loss, take_profit, "EMA Crossover Buy", MagicNumber, 0, clrGreen);

        if (ticket > 0)
            Print("Buy order opened successfully with ticket #", ticket);
        else
            Print("Error opening buy order, error code = ", GetLastError());
    }

    // شرط دخول الصفقة البيعية
    if (EMA5_Value < EMA10_Value && current_price < EMA200_Value)
    {
        // فتح صفقة بيع
        double stop_loss = current_price + StopLoss * Point;
        double take_profit = current_price - TakeProfit * Point;
        int ticket = OrderSend(_Symbol, OP_SELL, LotSize, current_price, 3, stop_loss, take_profit, "EMA Crossover Sell", MagicNumber, 0, clrRed);

        if (ticket > 0)
            Print("Sell order opened successfully with ticket #", ticket);
        else
            Print("Error opening sell order, error code = ", GetLastError());
    }
}