afl request

amitrandive

Well-Known Member
#2
XRAY27

I am currently learning AFL from Seniors in Traderji

Have come up with a crude version of your requirement .See if it helps.

Code:
P1 = Param("Period",10,0,100,1);
 
MyPDI= PDI(P1);//Positive Directional Indicator
 
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
 
MyADX= ADX(P1);//Average Directional Movement Index
 
//Green ADX Line=Rising; Red ADX Line=Falling
 
col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
Plot( MyADX,"ADX",col, styleLine,styleThick);
Plot( MyPDI,"+DI",colorGreen, styleLine,styleThick);
Plot( MyMDI,"-DI",colorBlue, styleLine,styleThick);
 

PlotOHLC(MyPDI,MyPDI,MyMDI,MyMDI,"",IIf(MyPDI>MyMDI,colorAqua,colorOrange),styleCloud);
 
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +"  ADX"
+ WriteVal( MyADX )+ EncodeColor(colorBlack) + "  +DMI" + WriteVal( MyPDI )+
EncodeColor(colorBlue) + "  -DMI" + WriteVal( MyMDI );
 

mastermind007

Well-Known Member
#4
XRAY27

I am currently learning AFL from Seniors in Traderji

Have come up with a crude version of your requirement .See if it helps.

Code:
P1 = Param("Period",10,0,100,1);
 
MyPDI= PDI(P1);//Positive Directional Indicator
 
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
 
MyADX= ADX(P1);//Average Directional Movement Index
 
//Green ADX Line=Rising; Red ADX Line=Falling
 
col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
Plot( MyADX,"ADX",col, styleLine,styleThick);
Plot( MyPDI,"+DI",colorGreen, styleLine,styleThick);
Plot( MyMDI,"-DI",colorBlue, styleLine,styleThick);
 

PlotOHLC(MyPDI,MyPDI,MyMDI,MyMDI,"",IIf(MyPDI>MyMDI,colorAqua,colorOrange),styleCloud);
 
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +"  ADX"
+ WriteVal( MyADX )+ EncodeColor(colorBlack) + "  +DMI" + WriteVal( MyPDI )+
EncodeColor(colorBlue) + "  -DMI" + WriteVal( MyMDI );

Amit

Good work.

Only 1 mistake of using comma instead of pipe in Plot functions. Further, I'd recommend use of styleNoTitle in the same.

Code:
	col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
	Plot( MyADX,"ADX",col,        styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
	Plot( MyPDI,"+DI",colorGreen, styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
	Plot( MyMDI,"-DI",colorBlue,  styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
 

amitrandive

Well-Known Member
#5
Amit

Good work.

Only 1 mistake of using comma instead of pipe in Plot functions. Further, I'd recommend use of styleNoTitle in the same.

Code:
	col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
	Plot( MyADX,"ADX",col,        styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
	Plot( MyPDI,"+DI",colorGreen, styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
	Plot( MyMDI,"-DI",colorBlue,  styleNoTitle | styleLine [B][COLOR="Red"]| [/COLOR][/B]styleThick);
mastermind007
Thanks for your comments :clapping:
 

amitrandive

Well-Known Member
#6
XRAY27

Complete AFL with Mastermind007's comments incorporated

Code:
P1 = Param("Period",10,0,100,1);
 
MyPDI= PDI(P1);//Positive Directional Indicator
 
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
 
MyADX= ADX(P1);//Average Directional Movement Index
 
//Green ADX Line=Rising; Red ADX Line=Falling
 
col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
	Plot( MyADX,"ADX",col,        styleNoTitle | styleLine | styleThick);
	Plot( MyPDI,"+DI",colorGreen, styleNoTitle | styleLine | styleThick);
	Plot( MyMDI,"-DI",colorBlue,  styleNoTitle | styleLine | styleThick);
 

PlotOHLC(MyPDI,MyPDI,MyMDI,MyMDI,"",IIf(MyPDI>MyMDI,colorAqua,colorOrange),styleCloud);
 
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +"  ADX"
+ WriteVal( MyADX )+ EncodeColor(colorBlack) + "  +DMI" + WriteVal( MyPDI )+
EncodeColor(colorBlue) + "  -DMI" + WriteVal( MyMDI );
 

pareshR

Well-Known Member
#7
Hi Amit

can you help how to use this afl ? specially Stock Fut?

thx
paresh


XRAY27

I am currently learning AFL from Seniors in Traderji

Have come up with a crude version of your requirement .See if it helps.

Code:
P1 = Param("Period",10,0,100,1);
 
MyPDI= PDI(P1);//Positive Directional Indicator
 
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
 
MyADX= ADX(P1);//Average Directional Movement Index
 
//Green ADX Line=Rising; Red ADX Line=Falling
 
col = IIf( MyADX > Ref( MyADX, -1 ), colorGreen, colorRed );
Plot( MyADX,"ADX",col, styleLine,styleThick);
Plot( MyPDI,"+DI",colorGreen, styleLine,styleThick);
Plot( MyMDI,"-DI",colorBlue, styleLine,styleThick);
 

PlotOHLC(MyPDI,MyPDI,MyMDI,MyMDI,"",IIf(MyPDI>MyMDI,colorAqua,colorOrange),styleCloud);
 
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +"  ADX"
+ WriteVal( MyADX )+ EncodeColor(colorBlack) + "  +DMI" + WriteVal( MyPDI )+
EncodeColor(colorBlue) + "  -DMI" + WriteVal( MyMDI );
 

amitrandive

Well-Known Member
#8
Hi Amit

can you help how to use this afl ? specially Stock Fut?

thx
paresh
pareshR

This AFL was a request from XRAY27.

Only thing I can tell you is that on any timeframe , you can remain long when the cloud is green and short when the cloud is red.Again it is liable to a lot of whipsaws.

So take care :thumb:
 

XRAY27

Well-Known Member
#9
paresh R
This adx should be used with other indicators for better results..use it alone will not work
 

Similar threads