"If" question - page 2

 

I dont know if it my browser or what the problem is, I have all kinds of problems posting replies and quotes in this forum, one thing that bugs me is when i do reply, more often than not my cursor is stuck in the quote box and wont come out.

 
SDC:

I dont know if it my browser or what the problem is, I have all kinds of problems posting replies and quotes in this forum, one thing that bugs me is when i do reply, more often than not my cursor is stuck in the quote box and wont come out.

Make sure you don't backspace before typing your message, it's very easy to remove the blank space after the quote but very hard to add it back in.
 

ok I didnt think i did that but i guess i could have without realizing.

 
RaptorUK:
Make sure you don't backspace before typing your message, it's very easy to remove the blank space after the quote but very hard to add it back in.

I agree it's very annoying, that occurs enough often.

In that case, I do the following :

  1. Click on HTML button
  2. Go to the end of html code
  3. Add the following </br>
  4. Click on VISUAL button to return to 'standard' editor.
 
SDC:

ok I didnt think i did that but i guess i could have without realizing.

I'm not saying you did just trying to suggest what might have happened, I do agree though the forum editor is pretty poor . . .
 
RaptorUK:

Nope . . .

is the same as

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.


Yes i understand now, boolean cant be compared with double.


So if i write it like this

if(EMA1<EMA2 && EMA2<EMA3 && EMA3<EMA4)
SELL=true;

This implies that all moving averages will be either under eachother or over eachother, in this case under the slowest one, so by using the < instead of <= that means that no MA will cross eachother they will move along like a wave-like MA structure, and always the quickest MA which in this case is the 1 period "EMA1" will be under EMA2 and EMA2 will be under EMA3 and EMA3 will be under EMA4... and so on, for the sell order to be triggered, right?

While

if(EMA1<EMA2<EMA3<EMA4)

Will result in an error, because its a nonsense.

 
Proximus:
if(EMA1<EMA2<EMA3<EMA4)

Will result in an error, because its a nonsense.


No it won't. You can do that and if they are all beneath each other that condition will be true.
 
SDC:

No it won't. You can do that and if they are all beneath each other that condition will be true.
No it won't . . . read my earlier post.
 
Proximus: So if i write it like this
if(EMA1<EMA2 && EMA2<EMA3 && EMA3<EMA4)
SELL=true;
Or learn to use booleans properly
SELL = EMA1<EMA2 && EMA2<EMA3 && EMA3<EMA4;
 
SDC: No it won't. You can do that and if they are all beneath each other that condition will be true.
True == 1, False == 0
EMA1 = 1.8;
EMA2 = 1.7;
EMA3 = 1.6;
EMA4 = 1.5;
if(EMA1<EMA2<EMA3<EMA4)
if(1.8 <1.7 <EMA3<EMA4)
if(   false <EMA3<EMA4)
if(       0 <1.6 <EMA4)
if(         true <EMA4)
if(            1 <1.5 )
if(            true   ) Print("1.8<1.7<1.6<1.5 is TRUE?")