Help regarding basic cross-over

Prium

New Member
#1
Hi,

I am new to AFL and would request help regarding the following condition:

I want a buy signal every time:

a. EMA 5 does a +ve cross over EMA 20 provided:
b. EMA 20 is greater than EMA 50
c. Both MACD(12,26) line and signal(12,26,9) line are above 0
d. MACD line is above signal line

Following is my AFL. Unfortunately does not generate results in the backtest for the period HCLTECH in the last 1 year

Please advice

Buy = Cross(EMA(Close, 5) , EMA(Close, 20))
AND EMA(Close, 20) > EMA(Close, 50)
AND MACD( 12, 26 ) > 0
AND Signal( 12, 26, 9) > 0
AND MACD( 12, 26 ) > Signal( 12, 26, 9);

Sell = Cross (0, MACD( 12, 26 ))
OR Cross (0, EMA(MACD( 12, 26 ),9))
OR Cross (Signal( 12, 26, 9), MACD( 12, 26 ));

Thanks!
 

asnavale

Well-Known Member
#2
Hi,

I am new to AFL and would request help regarding the following condition:

I want a buy signal every time:

a. EMA 5 does a +ve cross over EMA 20 provided:
b. EMA 20 is greater than EMA 50
c. Both MACD(12,26) line and signal(12,26,9) line are above 0
d. MACD line is above signal line

Following is my AFL. Unfortunately does not generate results in the backtest for the period HCLTECH in the last 1 year

Please advice

Buy = Cross(EMA(Close, 5) , EMA(Close, 20))
AND EMA(Close, 20) > EMA(Close, 50)
AND MACD( 12, 26 ) > 0
AND Signal( 12, 26, 9) > 0
AND MACD( 12, 26 ) > Signal( 12, 26, 9);

Sell = Cross (0, MACD( 12, 26 ))
OR Cross (0, EMA(MACD( 12, 26 ),9))
OR Cross (Signal( 12, 26, 9), MACD( 12, 26 ));

Thanks!
********************

Hi Prium,

Does your AFL generate results for any other stock? I doubt, it may not give results for any stock, or it may be a very rare case if you get the results. Just think over your logic you will get the answer why it does not give results. If you can't figure out the reason, put a message here in this thread.

-Anant
 

Prium

New Member
#3
********************

Hi Prium,

Does your AFL generate results for any other stock? I doubt, it may not give results for any stock, or it may be a very rare case if you get the results. Just think over your logic you will get the answer why it does not give results. If you can't figure out the reason, put a message here in this thread.

-Anant
Anant,

I understand that it is looking for the very day when the cross over happens and if all the conditions are not met on that very day then the result is a false. And you are right - it gave me 3 buys for a 9 year period for HCL!

Could you please help with the correct solution?
 

asnavale

Well-Known Member
#4
Anant,

I understand that it is looking for the very day when the cross over happens and if all the conditions are not met on that very day then the result is a false. And you are right - it gave me 3 buys for a 9 year period for HCL!

Could you please help with the correct solution?
Will explain this week end.

-Anant
 

Gaur_Krishna

Well-Known Member
#6
Dear Anantji & Vijay,

Thanks. Just a query? Can AMI AFLs be used for intraday live data as well? Does it support live data and generate live signals? If yes, waht is the best version of AMI and what's best (& economical) data feed?

Regards,
Gaur_Krishna

P.S. : If you put both names together "Anant Vijay" its name of the conchshell of Yudhishthir Maharaj of Mahabharat.... :) (BG 1.16 -18 http://vedabase.net/bg/1/16-18/en)

As like always...anantji always helps whenever anyone asks any querry about any afl :)
hats off anantji....
 

VJAY

Well-Known Member
#7
Dear GK,
yes you can...you can use any version abv 5.3..though am using 5.2 :)
many RT data veders are there...you can check in datafeed section in TJ...Investbulls(600+/PM),GDFL(1000+),etc....
 

johnnypareek

Well-Known Member
#8
Anant,

I understand that it is looking for the very day when the cross over happens and if all the conditions are not met on that very day then the result is a false. And you are right - it gave me 3 buys for a 9 year period for HCL!

Could you please help with the correct solution?
buy=cross no no use ema(c,5)>ema(c,20)

n put Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy); at end of your.

Enjoy n experiment at weekend :)
 
#9
Hi
I am testing this AFl and i like it personally
I want to use this AFL and seeing real trading in My country
Not Nifty but Thailand market it seems good system
I need to add another filter for this same system as indicator is wave trend the AFL is below if it is oversold -64 and all the original afl gives buy arrow then we enter buy
and sell only if the signal is in overbought zone 64 -70 then we enter sell
or we stay away from entering the trade and is it possible to add email and sound alert on the buy sell signal becase i am not infornt of my pc all time
Here is the code of wave trend afl

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));


ChannelPeriods = Param("Channel Periods",10,1,50,1);
AvgPeriods = Param("Average Periods",21,1,50,1);
OverBought = Param("Over Bought Line",64,0,100,1);
OverSold = Param("Over Sold Line",-64,-100,0,1);
ColTCI = ParamColor("TCI Line Color",colorBrown);
ColOB = ParamColor("Over Bought Color",colorRed);
ColOS = ParamColor("Over Sold",colorGreen);
XSpace = Param("GraphXSpace",7,0,20,0.5);

n1 = ChannelPeriods; // Channel periodsdefault is 10.
n2 = AvgPeriods; // Average periodsdefault is 21.

AP = Avg; //Typical Price
ESA = EMA(AP, n1);
D = EMA(abs(AP - ESA), n1);
CI = (AP - ESA) / (0.015 * D);
TCI = EMA(CI, n2);

WaveTrend1 = TCI;
WaveTrend2 = MA(WaveTrend1,4);

myColor = IIf (WaveTrend1 > WaveTrend2, colorBrightGreen,IIf (WaveTrend2 > WaveTrend1, colorRed ,colorLightYellow));

Plot(WaveTrend1,"WTrnd1 ",myColor,styleDots | styleThick);
//Plot(WaveTrend2,"WaveTrend2",colorLightYellow,styleDashed);
Plot(WaveTrend2,"WTrnd2",ParamColor("Signal Line color", colorLightBlue),styleDots);

Plot(OverBought,"OB Line",ColOB,8+16);//|styleNoLabel);//8+16
Plot(OverSold,"OS Line",ColOS,8+16);//|styleNoLabel);
Plot(n1,"Channel Periods",colorLightBlue,styleNoLabel |styleNoRescale |styleNoDraw);
Plot(n2,"Avg Periods",colorBlue,styleNoLabel |styleNoRescale | styleNoDraw);
Plot(0,"",colorRed,styleNoLabel);
//Plot(100,"",9 ,styleOwnScale | styleArea | styleNoLabel,-5,100);
//Background pane coloring

GraphXSpace = XSpace;



Thanks for good help
 

Similar threads