CLOSE croesses under MA doesn’t work?
- This topic has 4 replies, 3 voices, and was last updated 5 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Forums › ProRealTime English forum › ProBuilder support › CLOSE croesses under MA doesn’t work?
Hi,
I create an indicator and want to check if a bar is crosses under the MA10, MA20 and MA30 at the same day. If it is, then the output is minus. But it seems it doesn’t work always. See my attached screenshot.
My code looks as follow:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
... // MA MA1 = ExponentialAverage[10](close) MA2 = ExponentialAverage[20](close) MA3 = ExponentialAverage[30](close) ... ... cExit = (close crosses under MA1) and (close crosses under MA2) and (close crosses under MA3) ... ... if cExit then output = -1 else output = 0 ... RETURN output |
This works fine:
|
1 2 3 4 5 6 7 8 9 10 |
MA1 = ExponentialAverage[10](close) MA2 = ExponentialAverage[20](close) MA3 = ExponentialAverage[30](close) cExit = (close crosses under MA1) and (close crosses under MA2) and (close crosses under MA3) if cExit then output = -1 else output = 0 endif RETURN output |
Thanks first!
I simply copy your code and have a try by me. But it looks it doesn’t work 100%. See attached screenshots. Really strange. :-/
Check that periods and average type on your chart are the same as in your code and that you are using a numer of unit large enough (1K should do).