You need to break the code up, as I don't think you want what you have written. I think this is what you mean:
if (Close[0]>Close[1] && Close[1]>Close[2]) { //show signal on chart }
What you have written means something quite different: if (Close[0]>Close[1]>Close[2])
If Close[0] is greater than Close[1], the first bit will evaluate as true (which is numerically represented as 1)
This means you are actually asking if 1 is greater than Close[2].
If Close[0] is less than or equal to Close[1], the first bit will evaluate as false (which is numerically represented as 0)
This means you are actually asking if 0 is greater than Close[2].
You would get a warning about the above code (unsafe use of bool)
honest_knave: What you have written means something quite different: if (Close[0]>Close[1]>Close[2])
Exactly. true = 1 and false = 0 so you getif( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) | if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I tried to write it but fail, I am not sure how to write it.
here is concept
possible to show signal for 500 bars.
thanks in advance