can i use these () {} so much ?? - page 5

 
7bit:
If it were my job to fix your code and/or find the matching braces in your code then the very first thing I would do is to format it correctly in order to be able to actually read it.

how to use universalindentgui software ?
 

where the error ??

please, someone please help ....

 
albert_lim83:

where the error ??

please, someone please help ....

This is the code after formatting: It seems there are no curly braces missing but in a few of these ifs you forgot a ; after the OrderSend(). I did not change anything, only applied the code formatter, you can see how this already gives a totally different view on the code and can make errors obvious:

//+------------------------------------------------------------------+
//|                                                   NightMare1.mq4 |
//|                                             Copyright 2012, Abu. |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, Abu."
#property link      "https://www.metaquotes.net/"

extern string Name_Expert = "NightMare";
extern double StartHour1 = 0000;
extern double StopHour1  = 0759;
extern double StartHour2 = 0800;
extern double StopHour2  = 1859;
extern double StartHour3 = 1900;
extern double StopHour3  = 2359;
extern double LongTP1  = 80;
extern double ShortTP1 = 80;
extern double longSL1  = 150;
extern double ShortSL1 = 150;
extern double LongTP2  = 180;
extern double ShortTP2 = 180;
extern double longSL2  = 150;
extern double ShortSL2 = 150;
extern double LongTP3  = 50;
extern double ShortTP3 = 50;
extern double longSL3  = 150;
extern double ShortSL3 = 150;
extern double LotSize = 0.1;
extern double MaxOrders = 5;
extern double SafetyPercent = 50;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
   if(AccountFreeMargin()<(SafetyPercent/100)*AccountBalance()) {
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
   }
   if(Bars<50) {
      return(0);
   }
   if(OrdersTotal()>MaxOrders()) {
      return(0);
   }
   double diClose0=iClose(NULL,5,0);
   double diMA1=iMA(NULL,5,5,0,MODE_EMA,PRICE_OPEN,1);
   double diClose2=iClose(NULL,5,0);
   double diMA3=iMA(NULL,5,4,0,MODE_EMA,PRICE_OPEN,1);

   if (TimeCurrent()>StartHour1())&(TimeCurrent()<StopHour1()) {
      if ((diClose0<diMA1)) {
                                                  //----
         OrderSend(Symbol(),LongTP1,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
         return(0);
      }
      else
      if ((diClose2>diMA3)) {
                                                  //----
         OrderSend(Symbol(),ShortSL1,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
         return(0);
      }

      return(0);
   }

   if (TimeCurrent()>StartHour2())&&(TimeCurrent()<StopHour2()) {
      if ((diClose0<diMA1)) {
                                                  //----
         OrderSend(Symbol(),LongTP2,0.1,Ask,3,Bid-15*Point,Bid+15*Point)
            return(0);
      }
      else
      if ((diClose2>diMA3)) {
                                                  //----
         OrderSend(Symbol(),ShortSL2,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
         return(0);
      }
      return(0);
   }
   if (TimeCurrent()>StartHour3())&&(TimeCurrent()<StopHour3()) {
      if ((diClose0<diMA1)) {
                                                  //----
         OrderSend(Symbol(),LongTP3,0.1,Ask,3,Bid-15*Point,Bid+15*Point)
            return(0);
      }
      else
      if ((diClose2>diMA3)) {
                                                  //----
         OrderSend(Symbol(),ShortSL3,0.1,Ask,3,Bid-15*Point,Bid+15*Point)
            return(0);
      }
      return(0);
   }
   return(0);
}
 
ya, i saw that, i miss 3 ; after ordersend.
 
7bit:
If it were my job to fix your code and/or find the matching braces in your code then the very first thing I would do is to format it correctly in order to be able to actually read it.

Formatted correctly is a relative term . . .

 
7bit:

This is the code after formatting: It seems there are no curly braces missing but in a few of these ifs you forgot a ; after the OrderSend(). I did not change anything, only applied the code formatter, you can see how this already gives a totally different view on the code and can make errors obvious:


how the code formatter use ?

where the software,

can share to me ?

thanks ..

 
WHRoeder:

People have been helping you to extremes. You have been ABUSING the help here. Asking such elementary questions. Find the missing parentheses on your own. It's above the OrderSend, and took me about 20 seconds with notepad2 to find it.

So I have put you in the troll category and won't help you.

Well it's taken you a long time to figure that out! Whilst the usual trolls try to create arguments this troll is trying to create upset by being pathetically un-helpable. Since we all have a goal to help people he is creating a failed help situation which causes distress.


albert_lim83 I have seen your other long threads where you feign rank stupidity to upset the assembled genuine people here. Why don't you try finding something useful to do with your life?

You may be offended by my post if you like, but the forum rules only apply to human beings and not to trolls.

 

wait wait...

maybe that's my old post...

i already change the new life ...
 
albert_lim83:

how to use universalindentgui software ?

* paste the code into the editor (delete the example code)

* then select one of the formatting engines (I used BCPP but you can also use any other formatting engine that understands C/C++/Java)

* check the checkbox "live preview"

* play with the settings of the formatter until it formats the style that you prefer (BCPP has very few settings, so its simple to configure, use 3 spaces to indent and no tabs which is the MT4 default)

 
i really need you all to help me ...
Reason: