A quick question about brackets.

 

Quick question, does the following code mean "If either A OR B is true, execute position"?

Many thanks


if(BarTime != Time[0])

{

   if((Statement A)
   
      &&()
      &&()
      &&()
   
   )
   
   if((Statement B)
   
      &&()
      &&()
      &&()
   
   )
   
   {
   
   OrderSend();

   }

}
        OrderSend(...);

        }

}
 
You are focused on only one problem and you persistently want someone to do it for you. In fact, when you pass this problem, you will encounter other problems in order. Then what are you going to do, open a separate topic for each of them and try to get them done?
Instead of that, either write to the strategy freelance you want and someone will do it for you and try to understand how they did it from there, or start learning coding from the beginning.
 
BCCI: Quick question, does the following code mean "If either A OR B is true, execute position"?

No! It means this:

if( BarTime != Time[0] )
{
   if( (boolean expression A) && () && () && () )
   {
      if( (boolean expression B) && () && () && () )
      {
         OrderSend(); // Will only execute if all of the above are true!
      }
   }
}

OrderSend(...); // Will always execute irrespective of the above

It also means this:

if( ( BarTime != Time[0] ) && (boolean expression A) && () && () && () && (boolean expression B) && () && () && () )
{
   OrderSend(); // Will only execute if all of the above are true!
}

OrderSend(...); // Will always execute irrespective of the above

Suggestion: Always use braces for your "if" code blocks, irrespective of it being nested or not, irrespective of it only having one instruction or not, and always "style" or properly format and indent your code levels, and you will always be able to see the logic of the code more clearly.

if( boolean expression )
{
   // Execute if true
}
else
{
   // Execute if false
};
 
NB! By the way, your example code has two extra closing braces at the end which would cause a compile error!
 
Fernando Carreiro:
NB! By the way, your example code has two extra closing braces at the end which would cause a compile error!

Thanks Fernando, much appreciated.

 
Ahmet Metin Yilmaz:
You are focused on only one problem and you persistently want someone to do it for you. In fact, when you pass this problem, you will encounter other problems in order. Then what are you going to do, open a separate topic for each of them and try to get them done?
Instead of that, either write to the strategy freelance you want and someone will do it for you and try to understand how they did it from there, or start learning coding from the beginning.

<Deleted>

 

<Deleted>

 
BCCI:

<Deleted>

Take this as your last warning.

Your attitude will not be tolerated in this forum.

 
Keith Watford:

Take this as your last warning.

Your attitude will not be tolerated in this forum.

Sorry Keith, you're right. 

 
Mohsen Bjp:

.

In addition to this, I'm just getting errors that should not exist and that I have clearly addressed: 

"'if' - semicolon expected xxx 321 13" - there doesn't need to be a semicolon. I do not want to terminate the EA here.

"'(' - unbalanced left parenthesis xxx 319 12" - there are no unbalanced parenthesis - can see both parenthesis.

"')' - unexpected token xxx 334 92" - why is this token unexpected when the relevant coding is the correct way?

"'&&' - operand expected xxx 327 13" - again, no errors here either.

"'else' - semicolon expected xxx 324 10" - again, no semicolon is required.

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! 





 
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.








Reason: