Join our facebook group for Amibroker afl code discussion https://www.facebook.com/groups/603980776889348

Heikin Ashi With Buy Sell Arrows

Heikin Ashi With Buy Sell Arrows
Heikin Ashi With Buy Sell Arrows
//www.aflcode.com
_SECTION_BEGIN("Heikin");
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "Modified " + Name(), colorBlack, styleCandle );
_SECTION_END();

_SECTION_BEGIN("Asish_Indicator_01");

a = Param("Angle",30,15,45,1);
pd = Param("Period",5,4,6,1);
P = ParamField("Price field",3);

a= (22/7)*(a/180);
Num = 0;
Den = 0;

for(i=1; i<=pd; i++)
{
if(pd%2==0 AND i > pd/2) X = sin((i-1)*a);
else X = sin(i*a);

Num = Num + X*Ref(P,1-i);
Den = Den + X;
}

if (den!=0) j1 = Num / Den;

Plot(j1,"j1",IIf(j1 > Ref(j1,-1),colorBlueGrey,colorLime),styleThick);

Buy = Close > j1;
Sell = Close < j1;
Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); 
PlotShapes( shapeHollowUpArrow* Buy , colorBrightGreen ,0);
PlotShapes( shapeHollowDownArrow* Sell, colorRed ,0);
//Plot(0,"",colorDarkBlue,styleLine);

Filter = Buy OR Sell;
Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); 
AddTextColumn(FullName(),"Name");
AddColumn( Buy, "BUY" );
AddColumn( Sell, "SELL" );


_SECTION_END();

_SECTION_BEGIN("Stop Loss");
a=.0174532;
S1=sin(1*a)*C;
S2=sin(2*a)*Ref(C,-1);
S3=sin(3*a)*Ref(C,-2);
S4=sin(4*a)*Ref(C,-3);
S5=sin(5*a)*Ref(C,-4);
Num=S1+S2+S3+S4+S5;
Den=sin(a)+sin(2*a)+sin(3*a)+sin(4*a)+sin(5*a);
j1= Num/Den;
Plot(j1,"Stop Loss",ParamColor( "Color",13 ), styleLine | styleThick );
_SECTION_END();
Previous
Next Post »