Coding for recent EMA crossover
- This topic has 6 replies, 3 voices, and was last updated 8 years ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
Similar topics:
Forums › ProRealTime English forum › ProScreener support › Coding for recent EMA crossover
Hi.
If I have the following code, how could I include in the condition that the EMA crossover happens within the previous 3 days if it’s part of a larger scan with more conditions? As it stands this code could give results that have just crossed over or those that crossed over 6 month previous and are still climbing.
In essence, sine EMA’s are lagging indicators I’d like to screen for crossovers that happened, say, within the last week or so.
1 2 3 4 5 6 7 8 |
timeframe(Daily) EMA20 = ExponentialAverage[20] (close) EMA100 = ExponentialAverage[100] (close) Condition = (EMA20 > EMA100) SCREENER[Condition] |
The line breaks have got lost somehow in the code.
1 2 3 4 5 |
If ema1 crosses over ema2 then Event = 1 Else event = 0 Endif |
I have coded something similar here, I think:
http://www.prorealcode.com/topic/screen-condition-c-within-last-x-days/
Find exclusive trading pro-tools on