Can someone fix this code for me i am newbie

 
// Déclarations
double MMS5, MMS35;
int ACHAT1, VENTE1;

// Fonction OnCalculate
void OnCalculate(const int rates_total,
                 const int prev_calculated,
                 const int begin,
                 const double &price[])
{
   MMS5 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 1);
   MMS35 = iMA(NULL, 0, 35, 0, MODE_EMA, PRICE_CLOSE, 1);

   bool condition1 = (MMS5 > MMS35) && (MMS5 <= price[0]) && (MMS5 > price[1]) && (MMS35 <= price[1]);
   bool condition2 = (MMS35 > MMS5) && (MMS35 <= price[0]) && (MMS35 > price[1]) && (MMS5 <= price[1]);

   if (condition1)
   {
      ACHAT1 = 1;
   }
   else
   {
      ACHAT1 = 0;
   }

   if (condition2)
   {
      VENTE1 = -1;
   }
   else
   {
      VENTE1 = 0;
   }

   if (ACHAT1 != 0)
   {
      ObjectCreate(« arrowup », OBJ_ARROW, 0, Time[0], Low[0] - AverageTrueRange(14) * 1.5);
      ObjectSet(« arrowup », OBJPROP_COLOR, YellowGreen);
   }
   sinon si (VENTE1 != 0)
   {
      ObjectCreate(« arrowdown », OBJ_ARROW, 0, Time[0], High[0] + AverageTrueRange(14) * 1.5);
      ObjectSet(« arrowdown », OBJPROP_COLOR, Magenta);
   }
}

Fonction OnInit
int OnInit()
{
   Définition des propriétés de l’indicateur
   IndicatorSetString(INDICATOR_SHORTNAME, « MonIndicateur »);
   IndicatorSetInteger(INDICATOR_DIGITS, 5);
   IndicatorSetInteger(INDICATOR_LEVELS, 2);
   IndicatorSetString(INDICATOR_LEVELNAME, 0, « Niveau 1 »);
   IndicatorSetString(INDICATOR_LEVELNAME, 1, « Niveau 2 »);

   retour(INIT_SUCCEEDED);
} 

This post was modified by a moderator

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Program Properties (#property) - Preprocessor - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Please post in English only on this forum.

You can use automatic translation tool if needed.

I have edited your post. In future please and use the CODE button when you insert code.

Code button in editor

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 have moved your topic to the correct section later, please don't create another topic.

Usually people who cannot code do not receive free help on this forum, although it could happen if you are lucky. Be patient.

  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
  • Finally, you also have the option to hire a programmer in the Freelance section.