Hello trading friends,
I am new to the Prorealtime programming. I am a programmer by professional. But I am not sure how to translate trading in to coding. If you can help me to learn, I would like to contribute here as well (Have few sparetime) 🙂
My question:
How to find my exponential moving average 8, 21, 50 are in numerical order or not?
Hi Guys,
I was curious on the first day here and I created this. Any improvements?
TIMEFRAME(1 hour)
ma8=average[8](close)
ma21=average[21](close)
ma50=average[50](close)
c1 = ma8 > ma21
c2 = ma21 > ma50
up = c1 and c2
c3 = ma50 > ma21
c4 = ma21 > ma50
down = c3 and c4
SCREENER[up OR down](close as "close")
Hi Delta, sorry for not answering earlier. You made a wrong typo at line 15 and 16 (conditions c3 and c4 : same MA but different order).
It is not necessary to indicate a timeframe, unless you want to make a multitimeframe screener.
If c1 and c2 are not true at the same time, you are “down”, so your “down” boolean variable is not necessary, just check if up is true or not and you’ll the bullish and bearish momentum in your screener.
I m not sure I understand you.
MA 8, 21, 50 is in proper order: i would say momentum is UP
MA 50, 21, 8 is in proper order: i would say momentum is DOWN
I want the screener to list either UP or DOWN
This is what I tried to achieve in the above code.
This is how it should be coded:
ma8=average[8](close)
ma21=average[21](close)
ma50=average[50](close)
c1 = ma8 > ma21
c2 = ma21 > ma50
up = c1 and c2
down = not c1 and not c2
SCREENER[up OR down](close as "close")
If the moving averages are not in the proper order for “up”, they are obviously in the proper order for “down”.
Thanks Nick!.. thats way better than original.. 😛