Lets consider 4 moving averages:
Now if i want to test a buy or sell condition we use the BUY and SELL booleans, the question is:
Is this equivalent
to this?
The answer is no
From what I have experienced
if(EMA1<EMA2<EMA3<EMA4) SELL=true;
is equivalent to
if(EMA1<EMA2 || EMA1<EMA3 || EMA1<EMA4) SELL=true;
I'm not certain enough to actually code in this way though.
The answer is no
From what I have experienced
is equivalent to
Nope . . .
if(EMA1<EMA2<EMA3<EMA4) SELL=true;
is the same as
if( ( (EMA1<EMA2) < EMA3 ) < EMA4) SELL=true;
and the problem with this is that EMA1, EMA2, EMA3 and EMA4 are all doubles, but the expression (EMA1 < EMA2) results in a bool, so (EMA1 < EMA2) < EMA3 is testing a bool against a double and is not what was ever intended.
Nope . . .
is the same as
if( ( (EMA1<EMA2) < EMA3 ) < EMA4) SELL=true;
and the problem with this is that EMA1, EMA2, EMA3 and EMA4 are all doubles, but the expression (EMA1 < EMA2) results in a bool, so (EMA1 < EMA2) < EMA3 is testing a bool against a double and is not what was ever intended.
Hi RaptorUK,
sorry, but I don't quite understand your answer
I think that there may be a typo in there because you have 2 open brackets and 3 close brackets
Hi RaptorUK,
sorry, but I don't quite understand your answer
I think that there may be a typo in there because you have 2 open brackets and 3 close brackets
The brackets look OK to me . . . here they are coloured and spaced out . . .
if ( ( ( EMA1 < EMA2 ) < EMA3 ) < EMA4 ) SELL=true;
. . . the < happens left to right so (EMA1 < EMA2) happens first and a bool is returned, next will be bool < EMA3
The brackets look OK to me . . . here they are coloured and spaced out . . .
. . . the < happens left to right so (EMA1 < EMA2) happens first and a bool is returned, next will be bool < EMA3
I apologise RaptorUK, I must have had a cross-eyed moment :(

RaptorUK,
I know it is off topic, but how do you manage to highlight with different background colours?
Whenever I have tried to highlight in SRC, the whole code disappears!
RaptorUK,
I know it is off topic, but how do you manage to highlight with different background colours?
Whenever I have tried to highlight in SRC, the whole code disappears!

You highlight after you have added the SRC not in the SRC window
Thaks RaptorUK, that has been bugging me!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Lets consider 4 moving averages:
Now if i want to test a buy or sell condition we use the BUY and SELL booleans, the question is:
Is this equivalent
to this?
If they are equivalent then the other question is how many variables can i link together in the same operation with the >, <, <=, >=, ||, && operators?
If not then why not?