[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 320

 

Good evening all!

Please tell me, I compiled the program, but I got an error "'\end_of_program' - unbalanced left parenthesis D:\Program Files\MetaTrader 4 - Alpari\experts\probota 4.mq4 (161, 4)".

I checked everything, everything is correct. What can this error be related to?

 
Boneshapper:

Good evening all!

Please tell me, I compiled the program, but I got an error "'\end_of_program' - unbalanced left parenthesis D:\Program Files\MetaTrader 4 - Alpari\experts\probota 4.mq4 (161, 4)".

I checked everything, everything is correct. What can this error be related to?


For example, missing parenthesis in any condition... Either compile not the EA itself, but one of its inludes...
 
Boneshapper:

Good evening all!

Please tell me, I compiled the program, but it generates error "'\end_of_program' - unbalanced left parenthesis D:\Program Files\MetaTrader 4 - Alpari\experts\probota 4.mq4 (161, 4)".

I've checked everything, everything is correct. What can this error be connected to?


The compiler has given you the line number (161) in parentheses, where there is a missing or extra bracket.

Double click on the error text and the compiler will show you the error location.

 

Hello everyone!

Dear Professionals!!!

Look, please, what the problem is I don't understand. When I try to place one pending order, it puts out two.

while (Ticket2<0)

{

RefreshRates();

Ticket2=OrderSend(Symbol(),2,Lots_New*2,price,2,0,TP,"",MN); //1 order is pending Buy

Alert ("Error in Cycle",GetLastError()); Alert ("TIK2= ",Ticket2;)

Sleep(500);

}

Thanks in advance to everyone who responds.
 

someone can help to change the code so that the indicator does not have to be updated on each bar manually

#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 MediumBlue
#property indicator_color3 Yellow
#property indicator_color4 MediumBlue
#property indicator_color5 Green
#property indicator_color6 Red
#property indicator_separate_window

extern int RSI_Period = 40;         //8-25
extern int RSI_Price = 0;           //0-6
extern int Volatility_Band = 34;    //20-40
extern int RSI_Price_Line = 2;      
extern int RSI_Price_Type = 0;      //0-3
extern int Trade_Signal_Line = 7;   
extern int Trade_Signal_Type = 0;   //0-3
extern int NumberOfComputations =    2;
extern  int PeriodNorm=10;
extern int NumberOfBars         = 2000;

double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[];

int init()
  {
   IndicatorShortName("Traders Dynamic Index SSA_normalize");
   SetIndexBuffer(0,RSIBuf);
   SetIndexBuffer(1,UpZone);
   SetIndexBuffer(2,MdZone);
   SetIndexBuffer(3,DnZone);
   SetIndexBuffer(4,MaBuf);
   SetIndexBuffer(5,MbBuf);
   
   SetIndexStyle(0,DRAW_NONE); 
   SetIndexStyle(1,DRAW_LINE); 
   SetIndexStyle(2,DRAW_LINE,0,2);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE,0,2);
   SetIndexStyle(5,DRAW_LINE,0,2);
   
   SetIndexLabel(0,NULL); 
   SetIndexLabel(1,"VB High"); 
   SetIndexLabel(2,"Market Base Line"); 
   SetIndexLabel(3,"VB Low"); 
   SetIndexLabel(4,"RSI Price Line");
   SetIndexLabel(5,"Trade Signal Line");
 
   SetLevelValue(0,50);
   SetLevelValue(1,68);
   SetLevelValue(2,32);
   SetLevelStyle(STYLE_DOT,1,DimGray);
   
   return(0);
  }

int start()
  {
   double MA,RSI[];
   ArrayResize(RSI,Volatility_Band);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iCustom(Symbol(),Period(),"#_FullSSA_normalize",RSI_Period,NumberOfComputations,PeriodNorm,NumberOfBars,RSI_Price,0,i);
      MA = 0;
      for(int x=i; x<i+Volatility_Band; x++) {
         RSI[x-i] = RSIBuf[x];
         MA += RSIBuf[x]/Volatility_Band;
      }
      UpZone[i] = (MA + (1.6185 * StDev(RSI,Volatility_Band)));
      DnZone[i] = (MA - (1.6185 * StDev(RSI,Volatility_Band)));  
      MdZone[i] = ((UpZone[i] + DnZone[i])/2);
      }
   for (i=limit-1;i>=0;i--)  
      {
       MaBuf[i] = (iMAOnArray(RSIBuf,0,RSI_Price_Line,0,RSI_Price_Type,i));
       MbBuf[i] = (iMAOnArray(RSIBuf,0,Trade_Signal_Line,0,Trade_Signal_Type,i));   
      } 
//----
   return(0);
  }
  
double StDev(double& Data[], int Per)
{return(MathSqrt(Variance(Data,Per)));
}
double Variance(double& Data[], int Per)
{double sum, ssum;
  for (int i=0; i<Per; i++)
  {sum += Data[i];
   ssum += MathPow(Data[i],2);
  }
  return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+
 
Roman.:

For example, missing parenthesis in any condition... Or you don't compile the Expert Advisor itself, but one of its inludes...

Thanks, I will check it more carefully
 
DhP:


The compiler will tell you the line number (161) where the bracket is missing or extra.

Double-click on the error text and the compiler will tell you where the error is.


Thanks for the tip!
 
Boneshapper:

It's not working. Still buys a bunch:( Please tell me what else can be done.

Strange, the code works. Maybe not attached there?
 
Roger:

Weird, the code works. Maybe you put it in the wrong place?
It seems to be correct. I checked it several times. I showed Alert value 1 after the transaction. All days are normal, but why exactly 12.10.2010 it buys such a bunch - I can't understand.
 
Roger:

Weird, the code works. Maybe you put it in the wrong place?

When I write this, I don't write Flag=0 in front of the condition, because then it will be updated every time before a transaction and will always be 0. If we don't specify a value, for example just int Flag, the program will assign it 0, right?
Reason: