Programming error that I can't fix

 
 void OnStart()
{
    // la valeur actuelle des bandes de Bollinger
    double upperBand = iBands("EURUSD", PERIOD_M15, 20, 1.0, 0, PRICE_CLOSE, MODE_SMA,2);
    double lowerBand = iBands("EURUSD", PERIOD_M15, 20, 1.0, 0, PRICE_CLOSE, MODE_SMA,0);
    double middleBand = iBands("EURUSD", PERIOD_M15, 20, 1.0, 0, PRICE_CLOSE, MODE_SMA,1);

    // définir les conditions d'ouverture et de fermeture d'ordre
    if (Close[1] < lowerBand && Close > middleBand && totalOrders < 50)
      
        //boucle pour créer plusieurs ordres
        for (int i=0;i<50;i++);

            // ouvre un ordre d'achat avec un stop loss défini en pourcentage du portefeuille ou en pips
            // ajoute des positions
            
            totalOrders++;
        
    
    else if (Close[1] > upperBand || Close < middleBand)

        // boucle pour fermer tous les ordres en cours
        for (int i=0;i<totalOrders;i++);

            // fermer l'ordre d'achat
            // fermer la position
        
        totalOrders = 0; //réinitialiser le compteur d'ordres
    
    
    else if (Close[1] > upperBand && Close < middleBand && totalOrders < 50) 

        // boucle pour créer plusieurs ordres
        for (int i=0;i<50;i++);

            // ouvrir un ordre de vente avec un stop loss défini en pourcentage du portefeuille ou en pips
            // ajouter des positions
            totalOrders++;
        
    
    else if (Close[1] < lowerBand || Close > middleBand) 

        // boucle pour fermer tous les ordres en cours
        for (int i=0;i<totalOrders;i++);

            // fermer l'ordre de vente
            // fermer la position
        
        totalOrders = 0; //réinitialiser le compteur d'ordres
    
    }
 

Good morning,

As the title indicates, I have errors in my program that I cannot correct.

If someone can help me that would be great :)

Here are the errors:

'Close' - invalid array access My Boll2.mq4 37 33

'totalOrders' - undeclared identifier My Boll2.mq4 37 55

'else' - illegal 'else' without matching 'if' My Boll2.mq4 48 5

'else' - illegal 'else' without matching 'if' My Boll2.mq4 59 5

'else' - illegal 'else' without matching 'if' My Boll2.mq4 69 5

'Close' - access to invalid bay My Boll2.mq4 37 33


Thank you in advance for your help.

Good day

 

Please don't post randomly in any section. Your question is not related to the section you posted.

MT4/mql4 has it's own section on the forum.

I will move your topic to the correct section shortly, please don't create another topic.

 

You are missing array index on Close in every "if" condition.

if (Close[1] < lowerBand && Close > middleBand && totalOrders < 50)


You have ";" after each for loop expression - orders after that are executed only once and that's the reason why you have "illegal else" errors.

       for (int i=0;i<50;i++);


You are missing "#property strict" and because of that you will get "variable already defined error" error 


Besides that, this code is not complete - where is "totalOrders" variable declaration?