AFL Coding Required, Plz Help!!!

I

indiabulz

Guest
#1
Hello Traderji,

I have devised new trading system which works great for me. I just need the AFL coding for it. The System is as follows:

Chart: Daily

Conditions for Buying:
1) Volume of Today > Volume of Previous Day.
2) Todays Candle is a Dark candle i.e. Close < Open
3) Closing Price > EMA (20) & EMA (40) in Daily and Weekly Garph both.
4) 30 < ADX < 50.

Backtesting:
While performing backtesting Buy should be at the open of the next day and selling at the close of the same day.

Scanning:
While perfomring scanning the Buy indication should be given on the dark candle of today.


I would be very grateful for this code. Thanks in Advance!!!
 

singhboy

Active Member
#2
Buy = V> Ref(V,-1) AND Close<Open AND C > EMA(C,20) AND C> EMA(C,40) AND ADX(15)> 30 AND ADX(15) < 50;
Filter= Buy ;
SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);
AddColumn(Buy,"buy",1.2);
May be it works
 
#5
This doesn't take into consideration weekly time frame. I have added the weekly condition to this code. Correct me if i am wrong.

settradedelays( 1, 1, 1, 1 ) //To delay the trade by one day.
cond1 = V> Ref(V,-1) AND Close<Open AND C > EMA(C,20) AND C> EMA(C,40) AND ADX(15)> 30 AND ADX(15) < 50;
TimeFrameSet(inWeekly);
cond2 = C > EMA(C,20) AND C > EMA(C,40);
TimeFrameRestore();
Buy = cond1 AND cond2;
Filter= Buy;
SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);
AddColumn(Buy,"buy",1.2);

Buy = V> Ref(V,-1) AND Close<Open AND C > EMA(C,20) AND C> EMA(C,40) AND ADX(15)> 30 AND ADX(15) < 50;
Filter= Buy ;
SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);
AddColumn(Buy,"buy",1.2);
May be it works
 
Last edited:

mahesh2007

Active Member
#6
try this afl code-
_C1=V>Ref(V,-1) AND C<O AND C>EMA(C,20) AND C>EMA(C,40) AND ADX(14)>30 AND ADX(14)<50;
TimeFrameRestore();

TimeFrameSet(inWeekly);
_C2=C>EMA(C,20) AND C>EMA(C,40);
TimeFrameRestore();
Buy=_C1 AND _C2;

Filter=Buy;
AddColumn(C, "CMP", 1.2);
AddColumn(Buy,"buy",1.2);
AddColumn(_C1,"c1");
AddColumn(_C2,"c2");
 

singhboy

Active Member
#7
@trading4 and Mahesh. Doesnt it require time frame expansion like,
cond1 = V> Ref(V,-1) AND Close<Open AND C > EMA(C,20) AND C> EMA(C,40) AND ADX(15)> 30 AND ADX(15) < 50;
TimeFrameSet(inWeekly);
cond2 = C > EMA(C,20) AND C > EMA(C,40);
TimeFrameRestore();
Buy = cond1 AND cond2(timeframeExpand,inweekly);
Filter= Buy;
SetOption("NoDefaultColumns", True);
 

Similar threads