Exploration for MA crossover

#3
m1 = MA(C, 10);
m2 = MA(C, 20);
m3 = MA(C, 89);
d = 0.01*C;
Cond1 = C - d;
Cond2 = C + d;

Filter = m1 > Cond1 AND m1 < Cond2
AND
Filter = m2 > Cond1 AND m1 < Cond2
AND
Filter = m3 > Cond1 AND m1 < Cond2;

AddColumn(C,"Close within 10, 20 & 89 SMA", colorBlue);


Check this afl if it is okay....
Do reply I am also learning afl programming
 
#4
Looks like it is not working...
I will try to find out where I am making mistake
 
#5
m1 = MA(C, 10);
m2 = MA(C, 20);
m3 = MA(C, 89);
d = 0.01*C;
Cond1 = C - d;
Cond2 = C + d;

Filter = m1 > Cond1 AND m1 < Cond2
AND
Filter = m2 > Cond1 AND m1 < Cond2
AND
Filter = m3 > Cond1 AND m1 < Cond2;

AddColumn(C,"Close within 10, 20 & 89 SMA", colorBlue);


Check this afl if it is okay....
Do reply I am also learning afl programming

m1 = MA(C, 10);
m2 = MA(C, 20);
m3 = MA(C, 89);
d = 0.01*C;
Cond1 = C - d;
Cond2 = C + d;

Filter = m1 > Cond1 AND m1 < Cond2
AND
Filter = m2 > Cond1 AND m2 < Cond2
AND
Filter = m3 > Cond1 AND m3 < Cond2;

AddColumn(C,"Close within 10, 20 & 89 SMA", colorBlue);

found the mistake I just copy pasted filter and forgot to change variables m1 to m2 and m3.
Problem solved now and now it is working
 

amitrandive

Well-Known Member
#7
Manoj

Can we plot this condition on the Chart also?

Also can we get a buy condition when the price crosses above the 89 period EMA and a sell when the price crosses below the 89 period EMA?

Thanks
Amit
 
#8
Manoj

Can we plot this condition on the Chart also?

Also can we get a buy condition when the price crosses above the 89 period EMA and a sell when the price crosses below the 89 period EMA?

Thanks
Amit
Plot this condition means ?
Do you want to plot moving averages on chart ?
we can get buy and sell condition
I will put the code
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?