AFL Help Needed !

lasty66

Active Member
#1
Hello friends,
I found this afl in wi********der.com webite.
An urgent request to all Traderji Gurus and Coders.....pls help me in plotting Trade Signals ( Buy/Sell arrows) in the afl....How to get Green=Buy (up arrow) red=Sell (down arrow)..:( :confused::eek:
Don't have any idea about coding..... below is the afl...



_SECTION_BEGIN("Looped Coppock Smoothner");
/* Looped Coppock Curve
Code By : Rohit Patil.
email : [email protected]
my thanks goes to te original Coppock logic creator
i'm just coder and little bit researcher or say improviser */

x=Param(" I : ",14,1,500,1);
y=Param(" II : ",11,1,500,1);

r=Param("Range : ",14,1,500,1);

p11 =ParamToggle("Plot 0 line","No,Yes",0);
p12 =ParamToggle("Plot +/- 6K lines","No,Yes",0);


Type = ParamList("Type", "ROC,CCi,Close");


bo=0;
bh=0;
bl=0;
bc=0;


if( Type == "ROC" )
{
for(i=0;i<=r;i++)
{
ao=(ROC(Ref(O,-i),x)*(r-i) + ROC(Ref(O,-i),y)*(r-i))/2;
bo=bo+ao;
ah=(ROC(Ref(H,-i),x)*(r-i) + ROC(Ref(H,-i),y)*(r-i))/2;
bh=bh+ah;
al=(ROC(Ref(L,-i),x)*(r-i) + ROC(Ref(L,-i),y)*(r-i))/2;
bl=bl+al;
ac=(ROC(Ref(C,-i),x)*(r-i) + ROC(Ref(C,-i),y)*(r-i))/2;
bc=bc+ac;

}
O=bo;H=bh;L=bl;C=bc;
}

if( Type == "CCi" )
{
for(i=0;i<=r;i++)
{
ao=(CCIa(Ref(O,-i),x)*(r-i) + CCIa(Ref(O,-i),y)*(r-i))/2;
bo=bo+ao;
ah=(CCIa(Ref(H,-i),x)*(r-i) + CCIa(Ref(H,-i),y)*(r-i))/2;
bh=bh+ah;
al=(CCIa(Ref(L,-i),x)*(r-i) + CCIa(Ref(L,-i),y)*(r-i))/2;
bl=bl+al;
ac=(CCIa(Ref(C,-i),x)*(r-i) + CCIa(Ref(C,-i),y)*(r-i))/2;
bc=bc+ac;

}
O=bo;H=bh;L=bl;C=bc;

}

if( Type == "Close" )
{
for(i=0;i<=r;i++)
{
ao=((Ref(O,-i)*(r-i)) + (Ref(O,-i)*(r-i)))/2;
bo=bo+ao;
ah=((Ref(H,-i)*(r-i)) + (Ref(H,-i)*(r-i)))/2;
bh=bh+ah;
al=((Ref(L,-i)*(r-i)) + (Ref(L,-i)*(r-i)))/2;
bl=bl+al;
ac=((Ref(C,-i)*(r-i)) + (Ref(C,-i)*(r-i)))/2;
bc=bc+ac;


}
d=0;
for(m=1;m<=r;m++)
{ d=d+m;
}
bo=bo/d;
bh=bh/d;
bl=bl/d;
bc=bc/d;

}



Col=IIf((Ref(bc,-1)==bc),colorBlack,IIf((Ref(bc,-1)<bc),colorLime,colorOrange));
PlotOHLC(bo,bh,bl,bc,"Coppock ("+r+") @ ("+Type+")",Col,ParamStyle("Copock sty ",styleLine,maskAll));


if(p11==1)
Plot(0,"",colorBlack,styleDashed);
if(p12==1)
{Plot(6000,"",ColorRGB(155,155,0),styleDashed);
Plot(-6000,"",ColorRGB(155,155,0),styleDashed);}
_SECTION_END();



Thanks

Regards

Vijay
 

sr114

Well-Known Member
#2
Hello friends,
I found this afl in wi********der.com webite.
An urgent request to all Traderji Gurus and Coders.....pls help me in plotting Trade Signals ( Buy/Sell arrows) in the afl....How to get Green=Buy (up arrow) red=Sell (down arrow)..:( :confused::eek:
Don't have any idea about coding..... below is the afl...



_SECTION_BEGIN("Looped Coppock Smoothner");
/* Looped Coppock Curve
Code By : Rohit Patil.
email : [email protected]
my thanks goes to te original Coppock logic creator
i'm just coder and little bit researcher or say improviser */

x=Param(" I : ",14,1,500,1);
y=Param(" II : ",11,1,500,1);

r=Param("Range : ",14,1,500,1);

p11 =ParamToggle("Plot 0 line","No,Yes",0);
p12 =ParamToggle("Plot +/- 6K lines","No,Yes",0);


Type = ParamList("Type", "ROC,CCi,Close");


bo=0;
bh=0;
bl=0;
bc=0;


if( Type == "ROC" )
{
for(i=0;i<=r;i++)
{
ao=(ROC(Ref(O,-i),x)*(r-i) + ROC(Ref(O,-i),y)*(r-i))/2;
bo=bo+ao;
ah=(ROC(Ref(H,-i),x)*(r-i) + ROC(Ref(H,-i),y)*(r-i))/2;
bh=bh+ah;
al=(ROC(Ref(L,-i),x)*(r-i) + ROC(Ref(L,-i),y)*(r-i))/2;
bl=bl+al;
ac=(ROC(Ref(C,-i),x)*(r-i) + ROC(Ref(C,-i),y)*(r-i))/2;
bc=bc+ac;

}
O=bo;H=bh;L=bl;C=bc;
}

if( Type == "CCi" )
{
for(i=0;i<=r;i++)
{
ao=(CCIa(Ref(O,-i),x)*(r-i) + CCIa(Ref(O,-i),y)*(r-i))/2;
bo=bo+ao;
ah=(CCIa(Ref(H,-i),x)*(r-i) + CCIa(Ref(H,-i),y)*(r-i))/2;
bh=bh+ah;
al=(CCIa(Ref(L,-i),x)*(r-i) + CCIa(Ref(L,-i),y)*(r-i))/2;
bl=bl+al;
ac=(CCIa(Ref(C,-i),x)*(r-i) + CCIa(Ref(C,-i),y)*(r-i))/2;
bc=bc+ac;

}
O=bo;H=bh;L=bl;C=bc;

}

if( Type == "Close" )
{
for(i=0;i<=r;i++)
{
ao=((Ref(O,-i)*(r-i)) + (Ref(O,-i)*(r-i)))/2;
bo=bo+ao;
ah=((Ref(H,-i)*(r-i)) + (Ref(H,-i)*(r-i)))/2;
bh=bh+ah;
al=((Ref(L,-i)*(r-i)) + (Ref(L,-i)*(r-i)))/2;
bl=bl+al;
ac=((Ref(C,-i)*(r-i)) + (Ref(C,-i)*(r-i)))/2;
bc=bc+ac;


}
d=0;
for(m=1;m<=r;m++)
{ d=d+m;
}
bo=bo/d;
bh=bh/d;
bl=bl/d;
bc=bc/d;

}



Col=IIf((Ref(bc,-1)==bc),colorBlack,IIf((Ref(bc,-1)<bc),colorLime,colorOrange));
PlotOHLC(bo,bh,bl,bc,"Coppock ("+r+") @ ("+Type+")",Col,ParamStyle("Copock sty ",styleLine,maskAll));


if(p11==1)
Plot(0,"",colorBlack,styleDashed);
if(p12==1)
{Plot(6000,"",ColorRGB(155,155,0),styleDashed);
Plot(-6000,"",ColorRGB(155,155,0),styleDashed);}
_SECTION_END();



Thanks

Regards

Vijay
how u propose to trade with this afl? any idea
 

mastermind007

Well-Known Member
#6
Thanks ...
Can u help me in plotting the up/down arrows?
Add following code in the end and it will plot the up-down arrows. If you plot the the coppock curve along with price chart, then you can use high low of candle to position the arrows more appropriately. For now, I've left all that positioning stuff as default since arrows are being plotted on the curve itself. Also, I am purposely not using buy sell (predefined variables) because I don't want this signals to interfere with anything else that may exist from elsewhere...
x = Ref(bc,-1)<bc;
y = Ref(bc,-1)>bc;
x = ExRem(x, y);
y = ExRem(y, x);
PlotShapes(x * shapeUpArrow, colorGreen, 0,0,-12);
PlotShapes(y * shapeDownArrow, colorRed, 0,0,-12);
 

lasty66

Active Member
#7
Add following code in the end and it will plot the up-down arrows. If you plot the the coppock curve along with price chart, then you can use high low of candle to position the arrows more appropriately. For now, I've left all that positioning stuff as default since arrows are being plotted on the curve itself. Also, I am purposely not using buy sell (predefined variables) because I don't want this signals to interfere with anything else that may exist from elsewhere...
Mastermind007 ji..... U are a gem to trading community....Thank you so much....:):thumb:
 

Similar threads