Help needed with AFL

mrm

New Member
#1
I'm trying to make afl to do following rules
Close today is 7day low
Buy on the close
Sell when stock closes on 7day high
I'm not programmer did try several ways without success
Can anybody help me with this?
Your help is much appreciated
 
#2
First of all I am not expert but your requirement is very basic i.e why i am trying to solve your problem. Afl is given below.

Buy=C<Ref(C,-1)
AND Ref(C,-1)<Ref(C,-2)
AND Ref(C,-2) < Ref(C,-3)
AND Ref(C,-3) <Ref(C,-4)
AND Ref(C,-4) <Ref(C,-5)
AND Ref(C,-5) <Ref(C,-6)
AND Ref(C,-6) <Ref(C,-7);

Sell=C>Ref(C,-1)
AND Ref(C,-1)>Ref(C,-2)
AND Ref(C,-2)>Ref(C,-3)
AND Ref(C,-3)>Ref(C,-4)
AND Ref(C,-4)>Ref(C,-5)
AND Ref(C,-5)>Ref(C,-6)
AND Ref(C,-6)>Ref(C,-7);

Filter=Buy OR Sell;
 

mrm

New Member
#3
Vijay
Thanks for your help I did change it to this and works. Yours was showing 7 consecutive low and i was looking for lowest low in 7days
Buy=C<Ref(C,-1)
AND Ref(C,0)<Ref(C,-2)
AND Ref(C,0) < Ref(C,-3)
AND Ref(C,0) <Ref(C,-4)
AND Ref(C,0) <Ref(C,-5)
AND Ref(C,0) <Ref(C,-6)
AND Ref(C,0) <Ref(C,-7)
AND C>EMA(C,275);

Sell=C>Ref(C,-1)
AND Ref(C,0)>Ref(C,-2)
AND Ref(C,0)>Ref(C,-3)
AND Ref(C,0)>Ref(C,-4)
AND Ref(C,0)>Ref(C,-5)
AND Ref(C,0)>Ref(C,-6)
AND Ref(C,0)>Ref(C,-7)
AND C>EMA(C,275);

Filter=Buy OR Sell;
not do to much but if you buy next day after lowest close do little better and only trade in bull market
 

Similar threads