How to fix unexpected end of program

 

Hi Guys it is me again

I started reading the documentation and I can't fix these 2 errors

'}' - unexpected end of program
'{' - unbalanced parentheses

Can someone help me

thanks

Files:
 

1. Always use the Code Styler - you will immediately see the place where the brace is not superfluous (or vice versa: the place where the brace is missing).

2. Remember: in MQL5 the indicator handle is created ONLY ONCE !!! And this is done in OnInit ().

Correct your mistakes and post the result.

 
Vladimir Karputov:

1. Always use the Code Styler - you will immediately see the place where the brace is not superfluous (or vice versa: the place where the brace is missing).

2. Remember: in MQL5 the indicator handle is created ONLY ONCE !!! And this is done in OnInit ().


Correct your mistakes and post the result.

Hi Vladimir, Thanks for your time and your answer friend.

but I am not a developer and I do not understand well.

I am empirical

remove this and I have more errors :(

int OnInit()
        {
         MAHandle = iMA(NULL, 0, MovingPeriod, MovingShift, MODE_SMMA, PRICE_CLOSE, pos);
         if(MAHandle == INVALID_HANDLE)
           {
            Print(“Error creating MA indicator”)


As I understood you, I was already defined here!

int OnInit()
  {

   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(0,PLOT_LINE_WIDTH,2);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,DeepPink);
   SetIndexBuffer(0,LineBuffer,INDICATOR_DATA);

   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(0,PLOT_LINE_WIDTH,2);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,DeepPink);
   SetIndexBuffer(5,ZL1);

   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(0,PLOT_LINE_WIDTH,2);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,DeepPink);
 

Do this: start building your program right from the beginning.

Open the MQL4 / MQL5 Wizard and create a program template.

Post the result.

MQL4/MQL5 Wizard - MetaEditor Help
MQL4/MQL5 Wizard - MetaEditor Help
  • www.metatrader5.com
MQL4/MQL5 Wizard allows you to quickly create program templates and ready-made trading robots. With the MQL4/MQL5 Wizard, a trader can develop...
 
Vladimir Karputov:

Do this: start building your program right from the beginning.

Open the MQL4 / MQL5 Wizard and create a program template.

Post the result.

Thanks again
 
Hell o I have an issue with the error undefined identifier how. Can I fix it
 
Noble Gab Amos #: I have an issue with the error undefined identifier how. Can I fix it
  1. Define your variables before you use them.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  2. Stop using ChatGPT.
              Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)

Reason: