"Unexpected end of program" and "Unbalanced parentheses" Expert Advisor Problem! - page 2

 
61597406:

ALGUEM ME AJUDA, eu nao sei o que fazer.
Someone helps me, i dont know what to do.

Remove this <chart>

 
Marco vd Heijden:

Remove this <chart>

The poster tried to compile a template and you advise him to remove a tag and retry. What kind of help is this?


61597406:
Someone helps me, i dont know what to do.

A template cannot be compiled, it needs to be MQL code. Files containg MQL end in .mq4, .mq5 or .mqh.

 
61597406:
SOMEONE HELP ME, I don't know what to do.
Someone helps me, i dont know what to do.
  1. Please post only in English on this forum. Use the automatic translation tool if needed. Use simple language structure when using mechanical translation.

  2. Don't post pictures of code, they are too hard to read.

    Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  3. Don't SHOUT at us — that is RUDE.
  4. What you wrote is not MQLx code. Learn to code or pay someone. They both look like some template — the extension is wrong and you don't compile them.
 

Hello Y'all,

So have been dealing with this problem for 2 days straight. 

It says the following: '}' - unexpected end of program

                                 '{' - Unbalanced parentheses 

      

Can somebody help me please?

I am getting quit fed up

Files:
 

Copy and paste your code using the code button (Ctrl+S).

Do not attach a photo.

 

hello. Can anyone help me. I don't know how anymore. when compiling a script appears " '}-'unexpected end of program" and " '}-' unbalanced parenthases"

double OnTester()

{

double ret=0.0;

return(ret);

}

void OnChartEvent(const int id, const long &lparam,

const double &dparam,

const string &sparam)

{

}

void OnTick()

{   <----here's the fault.

tickvalue = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);

minlot   = SymbolInfoDouble (_Symbol,SYMBOL_VOLUME_MIN);

lotstep   = SymbolInfoDouble (_Symbol,SYMBOL_VOLUME_STEP);

MinLots   = SymbolInfoDouble (_Symbol,SYMBOL_VOLUME_MIN);

 
Toto Widyanto #:


for starters read the rules of the forum and follow those rules for posting!

2. put } at the end of MinLots line.

 

@Wesley Machado 

void OnTick()

  {

    // Create variable for highest and lowes candle

   int HighestCandle,LowestCandle;

   

   // create Arrays for highest and lowest candle

   double High[],Low[];

   

   // sort array downwards from the current candle

   ArraySetAsSeries(High,true);

   

   // sort array downwards from the current candle

   ArraySetAsSeries(Low,true);

   

   // Fill array with data for 100 candle

   CopyHigh(_Symbol,_Period,0,100,High);

   

   // Fill array with data for 100 candle

   CopyLow(_Symbol,_Period,0,100,Low);

   

   // calculate the highest candle

   HighestCandle= ArrayMaximum(High,0,100);

   

   // calculate the highest candle

   LowestCandle= ArrayManimum(Low,0,100); 

   

   // Create an Array for price

   MqlRates PriceInformation[];

   

   // Sort it from current candle to oldeat candle

   ArraySetAsSeries(PriceInformation,true);

   

   // Copy price data into the array

   int Data-CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),PriceInformation;

   

   // Delete former Fibonacci object

   ObjectDelete(_Symbol,"Fibonacci");

   

   // Create the object

   ObjectCreate 

   (

    _Symbol,                                 // current chart

     "Fibonacci",                             // object name

     OBJ_FIBO,                                // object type

     0,                                       // in main window

     PriceInformation[100].time,              // left border candle100

     PriceInformation[HighestCandle].high,    // upper border higheat candel

     PriceInformation[0].time                 // right border candle0 

     PriceInformation[LowestCandle].low       // lower border lowest candle

   );

  

   // Get values

   

   datetime Datetime0 = ObjectGetInteger(0, "Fibonacci", OBJPROP_TIME,0);

   double PriceLevel100 = ObjectGetDouble(0, "Fibonacci", OBJPROP_PRICE,0);

   datetime DateTime1 = ObjectGetInteger(0, "Fibonacci", OBJPROP_TIME,1);

   double PriceLeve10 = ObjectGetDouble(0, "Fibonacci", OBJPROP_PRICE,1);

   

   double PriceLevel50=((PriceLevel100+PriceLeve10)*0.5);

    

    // Create a Chart output

    

    Comment (

               "DateTime0: ", DateTime0,"\n",

               "DateTime1: ", DateTime1,"\n",

               "PriceLevel 0: ",PriceLevel0,"\n",

               "PriceLevel 50: ",PriceLevel50,"\n",

               "PriceLevel00: ",PriceLevel100 

               

             );

          

      At compile time these are the errors!

     ';' - unexpected end of program

     '{' - unbalanced parentheses


 
Wesley Machado #:

@Wesley Machado 

void OnTick()

  {

    // Create variable for highest and lowes candle

   int HighestCandle,LowestCandle;

   

   // create Arrays for highest and lowest candle

   double High[],Low[];

   

   // sort array downwards from the current candle

   ArraySetAsSeries(High,true);

   

   // sort array downwards from the current candle

   ArraySetAsSeries(Low,true);

   

   // Fill array with data for 100 candle

   CopyHigh(_Symbol,_Period,0,100,High);

   

   // Fill array with data for 100 candle

   CopyLow(_Symbol,_Period,0,100,Low);

   

   // calculate the highest candle

   HighestCandle= ArrayMaximum(High,0,100);

   

   // calculate the highest candle

   LowestCandle= ArrayManimum(Low,0,100); 

   

   // Create an Array for price

   MqlRates PriceInformation[];

   

   // Sort it from current candle to oldeat candle

   ArraySetAsSeries(PriceInformation,true);

   

   // Copy price data into the array

   int Data-CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),PriceInformation;

   

   // Delete former Fibonacci object

   ObjectDelete(_Symbol,"Fibonacci");

   

   // Create the object

   ObjectCreate 

   (

    _Symbol,                                 // current chart

     "Fibonacci",                             // object name

     OBJ_FIBO,                                // object type

     0,                                       // in main window

     PriceInformation[100].time,              // left border candle100

     PriceInformation[HighestCandle].high,    // upper border higheat candel

     PriceInformation[0].time                 // right border candle0 

     PriceInformation[LowestCandle].low       // lower border lowest candle

   );

  

   // Get values

   

   datetime Datetime0 = ObjectGetInteger(0, "Fibonacci", OBJPROP_TIME,0);

   double PriceLevel100 = ObjectGetDouble(0, "Fibonacci", OBJPROP_PRICE,0);

   datetime DateTime1 = ObjectGetInteger(0, "Fibonacci", OBJPROP_TIME,1);

   double PriceLeve10 = ObjectGetDouble(0, "Fibonacci", OBJPROP_PRICE,1);

   

   double PriceLevel50=((PriceLevel100+PriceLeve10)*0.5);

    

    // Create a Chart output

    

    Comment (

               "DateTime0: ", DateTime0,"\n",

               "DateTime1: ", DateTime1,"\n",

               "PriceLevel 0: ",PriceLevel0,"\n",

               "PriceLevel 50: ",PriceLevel50,"\n",

               "PriceLevel00: ",PriceLevel100 

               

             );

          

      At compile time these are the errors!

     ';' - unexpected end of program

     '{' - unbalanced parentheses


The error message says it all, at one point you openned a block with { and forgot to close it with }.
 
Hello MQL4 Community. Can you please assist me with this expert advisor code. I am fairly new to coding so your support will be highly appreciated. The Two parentheses are giving me unexpected end and unbalanced errors..
void
TrailOrder(double Trailingstart,double Trailingstop) { int ticket = 0; double tStopLoss = NormalizeDouble(OrderStopLoss(), Digits); // Stop Loss int i,vPoint,vSlippage; double sl     = OrderStopLoss(); // Stop Loss     if (Digits == 3 || Digits == 5)     {vPoint = Point * 10; vSlippage = Slippage * 10;}     else     {vPoint = Point; vSlippage = Slippage;}      RefreshRates(); if(OrdersTotal()>0) { for(int i = OrdersTotal()-1; i >= 0; i--) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()&& (OrderMagicNumber() == M) { if(OrderType()==OP_BUY) { if(Ask> NormalizeDouble(OrderOpenPrice()+TrailingStart* vPoint,Digits)&& tStopLoss < NormalizeDouble(Bid-(TrailingStop+TrailingStep)*vPoint,Digits)) { tStopLoss = NormalizeDouble(Bid-TrailingStop*vPoint,Digits); ticket = OrderModify(OrderTicket(),OrderOpenPrice(),tStopLoss,OrderTakeProfit(),0,Blue); if (ticket > 0) { Print ("TrailingStop #2 Activated: ", OrderSymbol(), ": SL", tStopLoss, ": Bid", Bid); return(0);      }    } } if (OrderType()==OP_SELL) { if (Bid < NormalizeDouble(OrderOpenPrice()-TrailingStart*vPoint,Digits) && (sl >(NormalizeDouble(Ask+(TrailingStop+TrailingStep)*vPoint,Digits))) || (OrderStopLoss()==0)) { tStopLoss = NormalizeDouble(Ask+TrailingStop*vPoint,Digits); ticket = OrderModify(OrderTicket(),OrderOpenPrice(),tStopLoss,OrderTakeProfit(),0,Red); if (ticket > 0) { Print ("Trailing #2 Activated: ", OrderSymbol(), ": SL ",tStopLoss, ": Ask ", Ask); return(0);             }          }       }    } }
Reason: