AFL help for Exploration

#1
Hi All,

Need your help to have Exploration for the below mentioned conditions. I am not familiar with the Amibroker Formula Language.

1) Average 20 days Volume is Greater than or Equal to 300000
2) Today's Close is Greater than Rs 100 and
3) Today's Close is Greater than 10 days SMA of Close and Today's Close is Greater than 20 days SMA of Close
4) Todays High is Less than yesterdays High (H < H-1) and yesterdays High is Less than the High of day before (H-1 < H-2)
5) 3 days SMA of the Force Index is Less than or Equal to Zero
6) 13 days SMA of the Force Index is Greater than or Equal to Zero
7) ADX(20) is Greater than 30

I want to generate list of stocks which meets all of the above conditions with below mentioned columns.
Name, Close Price, 10 days SMA, 20 days SMA, 3 days SMA Force Index, 13 days SMA Force Index, ADX(20)

Thanking in advance for your help.

Best regards,
Bharat
 
#2
I Cant Understand About What Kind Of Exploration U Want (H < H-1),(H-1 < H-2) Kindly Explain Ur Condition One By One
If Possible Then By Candlesticks
 

Raju

Well-Known Member
#3
// This AFL contains criteria requested by bhka61
// I have tried coding as per requirements.
// Please check with some expert before using it...I ran it on last 30 days data on equity found ..ADANIENT

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), ParamStyle( "Style", styleHistogram | styleThick, maskHistogram ) );
_SECTION_END();

av=MA(V,20);
avvol20days = av >= 300000;//Average 20 days Volume is Greater than or Equal to 300000
ClOSEG100 = Close > 100;// Is Today's Close is Greater than Rs 100
CLG10SMA = Close > MA(C,10);//Is Today's Close is Greater than 10 days SMA of Close
CLG20SMA = Close > MA(C,20);//Is Today's Close is Greater than 20 days SMA of Close
THLYH = High < Ref(High,-1);// Is Today’s High is Less than yesterday’s High (H < H-1)
YHLDBYH = Ref(High,-1) < Ref(High,-2);//yesterday’s High is Less than the High of Day before (H-1 < H-2)

_SECTION_BEGIN("Force index 3 day");
FI3=MA(((C-Ref(C,-1))*V),3); // Please check if MA is allowed or EMA is compulsory in this formula - Alexandar
_SECTION_END();
FINDEX3 = FI3 <=0;//Is 3 days SMA of the Force Index is Less than or Equal to Zero

_SECTION_BEGIN("Force index 13 day");
FI13=MA(((C-Ref(C,-1))*V),13);// Please check if MA is allowed or EMA is compulsory in this formula - Alexandar
_SECTION_END();
FINDEX13 = FI13 <=0;//Is 13 days SMA of the Force Index is Greater than or Equal to Zero

//ADX criteria
ad20 = ADX(20) >30;// Is ADX(20) is Greater than 30


Filter = avvol20days AND ClOSEG100 AND CLG10SMA AND CLG20SMA AND THLYH AND YHLDBYH AND FINDEX3 AND FINDEX13 AND ad20;// all conditions satisfied
AddColumn(V,"VOLUME",1);
AddColumn(av,"av",1);
AddColumn(avvol20days,"avvol20days",1);
AddColumn(ClOSEG100,"ClOSEG100",1);
AddColumn(CLG10SMA,"CLG10SMA",1);
AddColumn(CLG20SMA,"CLG20SMA",1);
AddColumn(THLYH,"THLYH",1);
AddColumn(YHLDBYH,"YHLDBYH",1);
AddColumn(FINDEX3,"FINDEX3",1);
AddColumn(FINDEX13,"FINDEX13",1);
AddColumn(ad20,"ad20",1);
 
#4
// This AFL contains criteria requested by bhka61
// I have tried coding as per requirements.
// Please check with some expert before using it...I ran it on last 30 days data on equity found ..ADANIENT

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), ParamStyle( "Style", styleHistogram | styleThick, maskHistogram ) );
_SECTION_END();

av=MA(V,20);
avvol20days = av >= 300000;//Average 20 days Volume is Greater than or Equal to 300000
ClOSEG100 = Close > 100;// Is Today's Close is Greater than Rs 100
CLG10SMA = Close > MA(C,10);//Is Today's Close is Greater than 10 days SMA of Close
CLG20SMA = Close > MA(C,20);//Is Today's Close is Greater than 20 days SMA of Close
THLYH = High < Ref(High,-1);// Is Todays High is Less than yesterdays High (H < H-1)
YHLDBYH = Ref(High,-1) < Ref(High,-2);//yesterdays High is Less than the High of Day before (H-1 < H-2)

_SECTION_BEGIN("Force index 3 day");
FI3=MA(((C-Ref(C,-1))*V),3); // Please check if MA is allowed or EMA is compulsory in this formula - Alexandar
_SECTION_END();
FINDEX3 = FI3 <=0;//Is 3 days SMA of the Force Index is Less than or Equal to Zero

_SECTION_BEGIN("Force index 13 day");
FI13=MA(((C-Ref(C,-1))*V),13);// Please check if MA is allowed or EMA is compulsory in this formula - Alexandar
_SECTION_END();
FINDEX13 = FI13 <=0;//Is 13 days SMA of the Force Index is Greater than or Equal to Zero

//ADX criteria
ad20 = ADX(20) >30;// Is ADX(20) is Greater than 30


Filter = avvol20days AND ClOSEG100 AND CLG10SMA AND CLG20SMA AND THLYH AND YHLDBYH AND FINDEX3 AND FINDEX13 AND ad20;// all conditions satisfied
AddColumn(V,"VOLUME",1);
AddColumn(av,"av",1);
AddColumn(avvol20days,"avvol20days",1);
AddColumn(ClOSEG100,"ClOSEG100",1);
AddColumn(CLG10SMA,"CLG10SMA",1);
AddColumn(CLG20SMA,"CLG20SMA",1);
AddColumn(THLYH,"THLYH",1);
AddColumn(YHLDBYH,"YHLDBYH",1);
AddColumn(FINDEX3,"FINDEX3",1);
AddColumn(FINDEX13,"FINDEX13",1);
AddColumn(ad20,"ad20",1);
Hi Raju,

Thank you very much for the AFL. I will run it and provide you feedback.
Regarding Force Index, I will double check it whether MA is allowed or EMA is compulsory. Once again many thanks.

Regards,
Bharat