mt5 indicator open parenthesis expected

 
//+------------------------------------------------------------------+
//|                                              free tool B&C.mq5 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "traders profit club"
#property version   "1.01"
#property description "TRADE USING M5 Timeframe...GOOD LUCK"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 4

#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 0xE01CEB
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 5
#property indicator_color2 0xED1AD8
#property indicator_label2 "Sell"

#property indicator_type3 DRAW_ARROW
#property indicator_width3 5
#property indicator_color3 0xDDFAA2
#property indicator_label3 "Buy Weak"

#property indicator_type4 DRAW_ARROW
#property indicator_width4 5
#property indicator_color4 0xE9EB96
#property indicator_label4 "Sell Weak"

//--- Indicator buffers
double Buffer1[]; // Buy
double Buffer2[]; // Sell
double Buffer3[]; // Buy Weak
double Buffer4[]; // Sell Weak

//--- Hidden configuration variables
const double OS = 5.0;                 // Oversold level
const double OB = 95.0;                // Overbought level
const int Alerts = 1;                  // Alert setting
const int Macho_Period = 14;           // RSI period
const bool Send_Email = true;          // Email alerts
const bool Audible_Alerts = true;      // Sound alerts
const bool Push_Notifications = true;  // Push notifications

//--- Moving average handles
int MA50_handle;
int MA200_handle;
double MA50[];
double MA200[];

//--- RSI handle and buffers
int RSI_handle;
double RSI[];

//--- Allowed account numbers
long allowed_accounts[] = {31253646}; // Add your allowed account numbers here

//+------------------------------------------------------------------+
//| Account check function                                           |
//+------------------------------------------------------------------+
bool AccountCheck() {
    long account_number = AccountInfoInteger(ACCOUNT_LOGIN); // Account number is 'long'
    for(int i = 0; i < ArraySize(allowed_accounts); i++) {
        if(account_number == allowed_accounts[i])
            return true;
    }
    return false;
}

//+------------------------------------------------------------------+
//| Display warning message on the chart                            |
//+------------------------------------------------------------------+
void ShowWarningMessage(string message) {
    string obj_name = "AccountWarning";
    if(ObjectFind(0, obj_name) == -1) { // Create the object only if it doesn't exist
        ObjectCreate(0, obj_name, OBJ_LABEL, 0, 0, 0);
        ObjectSetInteger(0, obj_name, OBJPROP_COLOR, clrRed);
        ObjectSetInteger(0, obj_name, OBJPROP_FONTSIZE, 16);
        ObjectSetInteger(0, obj_name, OBJPROP_XDISTANCE, 10);
        ObjectSetInteger(0, obj_name, OBJPROP_YDISTANCE, 10);
    }
    ObjectSetString(0, obj_name, OBJPROP_TEXT, message);
}

//+------------------------------------------------------------------+
//| Alert function                                                   |
//+------------------------------------------------------------------+
void myAlert(string type, string message) {
    if(type == "print")
        Print(message);
    else if(type == "error") {
        Print(type + " | Spikes B&C @ " + Symbol() + "," + IntegerToString(Period()) + " | " + message);
    } else if(type == "indicator") {
        if(Audible_Alerts)
            Alert(type + " | Spikes B&C @ " + Symbol() + "," + IntegerToString(Period()) + " | " + message);
        if(Send_Email)
            SendMail("Spikes B&C", type + " | Spikes B&C @ " + Symbol() + "," + IntegerToString(Period()) + " | " + message);
        if(Push_Notifications)
            SendNotification(type + " | Spikes B&C @ " + Symbol() + "," + IntegerToString(Period()) + " | " + message);
    }
}

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
    //--- Account check
    if(!AccountCheck()) {
        string warning_message = "Account not authorized kindly inbox telegram @vixstratgy.";
        Print(warning_message);
        ShowWarningMessage(warning_message); // Show warning message on chart
        return(INIT_FAILED); // Prevents the indicator from loading if account is not allowed
    }

    //--- Set indicator buffers
    SetIndexBuffer(0, Buffer1);
    PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
    PlotIndexSetInteger(0, PLOT_ARROW, 233); // Up arrow

    SetIndexBuffer(1, Buffer2);
    PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
    PlotIndexSetInteger(1, PLOT_ARROW, 234); // Down arrow

    SetIndexBuffer(2, Buffer3);
    PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, EMPTY_VALUE);
    PlotIndexSetInteger(2, PLOT_ARROW, 233); // Up arrow (weak)

    SetIndexBuffer(3, Buffer4);
    PlotIndexSetDouble(3, PLOT_EMPTY_VALUE, EMPTY_VALUE);
    PlotIndexSetInteger(3, PLOT_ARROW, 234); // Down arrow (weak)

    //--- Initialize moving averages
    MA50_handle = iMA(NULL, PERIOD_M5, 50, 0, MODE_SMA, PRICE_CLOSE);
    if(MA50_handle < 0) {
        Print("Failed to create MA50: ", GetLastError());
        return(INIT_FAILED);
    }

    MA200_handle = iMA(NULL, PERIOD_M5, 200, 0, MODE_SMA, PRICE_CLOSE);
    if(MA200_handle < 0) {
        Print("Failed to create MA200: ", GetLastError());
        return(INIT_FAILED);
    }

    //--- Initialize RSI
    RSI_handle = iRSI(NULL, PERIOD_M5, Macho_Period, PRICE_CLOSE);
    if(RSI_handle < 0) {
        Print("The creation of iRSI has failed: RSI_handle=", INVALID_HANDLE);
        Print("Runtime error = ", GetLastError());
        return(INIT_FAILED);
    }

    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
    int limit = rates_total - prev_calculated;
    ArraySetAsSeries(Buffer1, true);
    ArraySetAsSeries(Buffer2, true);
    ArraySetAsSeries(Buffer3, true);
    ArraySetAsSeries(Buffer4, true);

    //--- Initial zero
    if (prev_calculated < 1)
    {
        ArrayInitialize(Buffer1, EMPTY_VALUE);
        ArrayInitialize(Buffer2, EMPTY_VALUE);
        ArrayInitialize(Buffer3, EMPTY_VALUE);
        ArrayInitialize(Buffer4, EMPTY_VALUE);
    }
    else
    {
        limit++;
    }

    //--- Copy indicator buffers
    if (BarsCalculated(RSI_handle) <= 0) return (0);
    if (CopyBuffer(RSI_handle, 0, 0, rates_total, RSI) <= 0) return (rates_total);
    ArraySetAsSeries(RSI, true);
    if (CopyBuffer(MA50_handle, 0, 0, rates_total, MA50) <= 0) return (rates_total);
    ArraySetAsSeries(MA50, true);
    if (CopyBuffer(MA200_handle, 0, 0, rates_total, MA200) <= 0) return (rates_total);
    ArraySetAsSeries(MA200, true);

    //--- Main loop
    for (int i = limit - 1; i >= 0; i--)
    {
        // Omit some old rates to prevent "Array out of range" or slow calculation
        if (i >= MathMin(50000 - 1, rates_total - 1 - 50))
            continue;

        //--- Buy signal
        if (RSI[1 + i] < OS && RSI[1 + i + 1] > OS && MA50[1 + i] > MA200[1 + i])
        {
            Buffer1[i] = low[1 + i] - (2 * Point); // Set buy arrow below the low
            myAlert("indicator", "Buy Signal"); // Alert
        }
        else
        {
            Buffer1[i] = EMPTY_VALUE;
        }

        //--- Sell signal
        if (RSI[1 + i] > OB && RSI[1 + i + 1] < OB && MA50[1 + i] < MA200[1 + i])
        {
            Buffer2[i] = high[1 + i] + (2 * Point); // Set sell arrow above the high
            myAlert("indicator", "Sell Signal"); // Alert
        }
        else
        {
            Buffer2[i] = EMPTY_VALUE;
        }

        //--- Weak buy signal
        if (RSI[1 + i] < 50 && RSI[1 + i + 1] > 50 && MA50[1 + i] > MA200[1 + i])
        {
            Buffer3[i] = low[1 + i] - (1 * Point); // Set weak buy arrow below the low
        }
        else
        {
            Buffer3[i] = EMPTY_VALUE;
        }

        //--- Weak sell signal
        if (RSI[1 + i] > 50 && RSI[1 + i + 1] < 50 && MA50[1 + i] < MA200[1 + i])
        {
            Buffer4[i] = high[1 + i] + (1 * Point); // Set weak sell arrow above the high
        }
        else
        {
            Buffer4[i] = EMPTY_VALUE;
        }
    }

    return (rates_total); // Return the total number of processed rates
}
//+------------------------------------------------------------------+

here is the error am facing

';' - open parenthesis expected MegaSpikes B&C-Mt5.mq5  208     45
';' - open parenthesis expected MegaSpikes B&C-Mt5.mq5  216     46
';' - open parenthesis expected MegaSpikes B&C-Mt5.mq5  224     45
';' - open parenthesis expected MegaSpikes B&C-Mt5.mq5  232     46
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
There is no predefined variable called "Point". It is either the variable "_Point" or the function "Point()";
Documentation on MQL5: Predefined Variables / _Point
Documentation on MQL5: Predefined Variables / _Point
  • www.mql5.com
The _Point variable contains the point size of the current symbol in the quote currency. You may also use the Point() function...