A quick question about brackets. - page 2

 
Dominik Egert:
Are these errors reported by the compiler?

Are you sure it is a software bug of such magnitude and nobody except you is having this issue?

Are you confident enough about coding to ask such a rookie question about if-statements and still assume your code is correct?

You already seem to have issues understanding the sense of ";" for a line termination and want to report a bug?

My assumption is, you will soon be reporting the next bug, concerning floating point numbers being buggy.

Let me tell you as an experienced IT pro. The error in almost all cases is in front of the PC, not within the PC.

This said, try to catch some knowledge by reading example code provided with the terminal and in the codebase, or maybe take the time and read the documentation, available online and offline.

Or watch some YouTube videos about coding.








Are these errors reported by the compiler? - Yes, they are.

Are you sure it is a software bug of such magnitude and nobody except you is having this issue? - How do you know nobody else is having such an issue, have you trawled through every single post on here, out of the millions on here?  

Are you confident enough about coding to ask such a rookie question about if-statements and still assume your code is correct? - Yes I absolutely am. I am more than capable of coding nested IF statements, my EA has plenty of them.

Let me tell you as an experienced IT pro. The error in almost all cases is in front of the PC, not within the PC. - Not disputing that, but when you've been coding for years with little issue, or issues that been quickly been resolved with a diagnostic's session, & now suddenly you're getting non-existent compiling errors, what would that say to you? Also, no, it wouldn't be in the PC, there's nothing wrong with the PC, it's the software that has been downloaded into the PC.

This said, try to catch some knowledge by reading example code provided with the terminal and in the codebase, or maybe take the time and read the documentation, available online and offline.

Or watch some YouTube videos about coding.
- I agree to both, it never hurts to expand your knowledge. 

All the best, 

 
Dominik Egert:
Are these errors reported by the compiler?

Are you sure it is a software bug of such magnitude and nobody except you is having this issue?

Are you confident enough about coding to ask such a rookie question about if-statements and still assume your code is correct?

You already seem to have issues understanding the sense of ";" for a line termination and want to report a bug?

My assumption is, you will soon be reporting the next bug, concerning floating point numbers being buggy.

Let me tell you as an experienced IT pro. The error in almost all cases is in front of the PC, not within the PC.

This said, try to catch some knowledge by reading example code provided with the terminal and in the codebase, or maybe take the time and read the documentation, available online and offline.

Or watch some YouTube videos about coding.








So what's wrong with this? PS I'm aware that the Global and Local Declarations have been omitted.

  if(BarTime != Time[0])
   
   {
   
      if(hammerHeadClose < hammerHeadOpen){
      
         if(bearHammerHead >= Transform(candleBodyLength,2))
         if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
      
      }
      
      else if(hammerHeadClose > hammerHeadOpen){
      
         if(bearHammerHead >= Transform(candleBodyLength,2))
         if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
      
      }
      
      if(bearHammerHead >= Transform(candleBodyLength,2))
      if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
   
      {
      
      OpenShort = OrderSend(Symbol(),OP_SELL,LotSize,MarketInfo(Symbol(),MODE_BID),100,((entryPriceBid/Point)+(stopLossPoints))*Point,((entryPriceBid/Point)-(stopLossPoints*RewardFactor))*Point,"Spread Charge £"+DoubleToStr((spread * tickvalue)*LotSize,2),Period(),0,sellcolor);

      }   
   
   }
 

I am not sure how it helps ... but there is one thread in Russian forum about new builds of MetaEditor for MT5b(and new errors which those builds are found).
And there is reply of admin (machine translation into English):

Forum on trading, automated trading systems and testing trading strategies

About build 2980 - enter into my position ...

MetaQuotes , 2021.06.21 10:46

The compiler gets harder and finds new types of errors.

Of the latter, there are often erroneous initializations of structures like = {0}.

The compiler is right.


 
Sergey Golubev:

I am not sure how it helps ... but there is one thread in Russian forum about new builds of MetaEditor for MT5b(and new errors which those builds are found).
And there is reply of admin (machine translation into English):


Thank you

 

There are no bugs.

Your code corrected (sort of)

   if(BarTime != Time[0])
     {
      if(hammerHeadClose < hammerHeadOpen)
        {

         if(bearHammerHead >= Transform(candleBodyLength,2))
            if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
               int x=1;  //You do nothing if the above ifs are true
        }

      else
         if(hammerHeadClose > hammerHeadOpen)
           {
            if(bearHammerHead >= Transform(candleBodyLength,2))
               if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
                  int x=1;  //You do nothing if the above ifs are true
           }

      if(bearHammerHead >= Transform(candleBodyLength,2))
         if(bearHammerHandle!=0 && (bearHammerHead / bearHammerHandle) <= hammerHandlePct)
           {

            OpenShort = OrderSend(Symbol(),OP_SELL,LotSize,MarketInfo(Symbol(),MODE_BID),100,((entryPriceBid/Point)+(stopLossPoints))*Point,((entryPriceBid/Point)-(stopLossPoints*RewardFactor))*Point,"Spread Charge £"+DoubleToStr((spread * tickvalue)*LotSize,2),Period(),0,sellcolor);

           }

     }
 
Keith Watford:

There are no bugs.

Your code corrected (sort of)

Good, thank you.

 

I have some tips for you.

Firstly, if you want help, please make sure that all variables are declared in the code that you post. If they are not, anybody checking the code will get a lot of undeclared variable errors when compiling.

Secondly, when the compiler reports errors, start checking and correcting from the first error reported. When an error is found by the compiler, it may give false errors after as the flow of the code has been corrupted by the first error. You can't expect the compiler to work miracles.

 
Keith Watford:

I have some tips for you.

Firstly, if you want help, please make sure that all variables are declared in the code that you post. If they are not, anybody checking the code will get a lot of undeclared variable errors when compiling.

Secondly, when the compiler reports errors, start checking and correcting from the first error reported. When an error is found by the compiler, it may give false errors after as the flow of the code has been corrupted by the first error. You can't expect the compiler to work miracles.

No worries, thanks for the advice. 

 

BCCI: In addition to this, I'm just getting errors that should not exist and that I have clearly addressed: ... I think there is a compiling issue with MetaEditor, I'm going to report a bug with them today because this getting silly now. There is absolutely nothing wrong with my coding. All I can say is thank God I'm not paying for this software because many poor innocent traders will be getting ripped off big style!

Please stop blaming the compiler. It is your code that is the problem.

Please understand that I am not criticising you, and I did not get off the wrong side of the bed (as you put it).

Please understand that you, like anyone who still does not fully grasp coding or understand how to properly structure your code (especially when it ends up so convoluted as your other thread), then the compiler is going to call you out on your errors.

So please, accept this humbly without arrogance, and you will see that it will be easier for you and us to communicate, while helping you to understand the issues.

Accept that your code is convoluted and stringy, and we will do our best (as long as you are not argumentative) to show examples of better code structure and proper use of if statements, expressions, code blocks, etc.

However, you will also have to put some effort into your own research by reading up documentation or books, or video courses. I would suggest you also look at C/C++ language sources (books, videos, website tutorials). Start with "C" as it is more basic and then build up to "C++" and "MQL".

Here are a few starting points for "C":

 
Fernando Carreiro:

Please stop blaming the compiler. It is your code that is the problem.

Please understand that I am not criticising you, and I did not get off the wrong side of the bed (as you put it).

Please understand that you, like anyone who still does not fully grasp coding or understand how to properly structure your code (especially when it ends up so convoluted as your other thread), then the compiler is going to call you out on your errors.

So please, accept this humbly without arrogance, and you will see that it will be easier for you and us to communicate, while helping you to understand the issues.

Accept that your code is convoluted and stringy, and we will do our best (as long as you are not argumentative) to show examples of better code structure and proper use of if statements, expressions, code blocks, etc.

However, you will also have to put some effort into your own research by reading up documentation or books, or video courses. I would suggest you also look at C/C++ language sources (books, videos, website tutorials). Start with "C" as it is more basic and then build up to "C++" and "MQL".

Here are a few starting points for "C":

Sure, thanks for your input.

Reason: