deepakgha
(Deepak Gharpure)
1
Hii I am using below formula for MA aligning for the first time but its not working. Any ideas?
v1=MA(STYLE=Exponential, BARS=21, CALC=Close) > MA(BARS=50, STYLE=Exponential, CALC=Close) > MA(BARS=100, CALC=Close, STYLE=Exponential) > MA(BARS=150, STYLE=Exponential, CALC=Close) > MA(BARS=200, STYLE=Exponential, CALC=Close); v1 ChangeTo 1
OPMV2012
(Mathew Verdouw, CMT, CFTe)
2
Hi Deepak,
What do you mean by aligning? Can you please provide more information?
Also please try to format the scripts so they are a little easier for us all to read.
All the best
Mathew
deepakgha
(Deepak Gharpure)
3
Hiii Sir,
I wanted to know when the MA make the following condition true for the first time.
MA 21 > MA 50
MA 50 > MA 100
MA 100 > MA 150
MA 150 > MA 200
For this i have used following code.
v1=MA(STYLE=Exponential, BARS=21, CALC=Close) > MA(BARS=50, STYLE=Exponential, CALC=Close) >
MA(BARS=100, CALC=Close, STYLE=Exponential) > MA(BARS=150, STYLE=Exponential, CALC=Close) >
MA(BARS=200, STYLE=Exponential, CALC=Close); v1 ChangeTo 1
Regards,
Deepak
Bearski79
(Matthew Humphreys)
4
Hi,
You’re looking for several criteria to be true at once, so you need to have them connected via AND operators.
Example:
V1 = MA(BARS=21, STYLE=Exponential, CALC=Close) ;
V2 = MA(BARS=50, STYLE=Exponential, CALC=Close) ;
V3 = MA(BARS=100, STYLE=Exponential, CALC=Close) ;
V4 = MA(BARS=150, STYLE=Exponential, CALC=Close) ;
V5 = MA(BARS=200, STYLE=Exponential, CALC=Close) ;
V6 = V1 > V2 and V2 > V3 and V3 > V4 and V4 > V5;
BARSTRUE(V6) == 1
You can then use the BARSTRUE() function to find the first bar where this criteria swaps from False to True.
On a chart it looks like this (Show View along the bottom).
After triggering, it won’t trigger again until the criteria goes back to False, then is met once more.
deepakgha
(Deepak Gharpure)
5
Hii Sir,
I used the suggested formula however the results are different.
Cant i use change to function.
Regards,
Deepak
Bearski79
(Matthew Humphreys)
6
Hi,
If you prefer to use ChangeTo you can. It’s a simple adjustment to the final line.
V1 = MA(BARS=21, STYLE=Exponential, CALC=Close) ;
V2 = MA(BARS=50, STYLE=Exponential, CALC=Close) ;
V3 = MA(BARS=100, STYLE=Exponential, CALC=Close) ;
V4 = MA(BARS=150, STYLE=Exponential, CALC=Close) ;
V5 = MA(BARS=200, STYLE=Exponential, CALC=Close) ;
V6 = V1 > V2 and V2 > V3 and V3 > V4 and V4 > V5;
V6 ChangeTo 1