Help for afl

#1
THIS LOOKS GOOD AFL BUT HAVING SOME PROBLEM ON AMIBROKER

SYNTAX ERROR

CAN ANYBODY CORRECT THIS

------------------------------------------------------------------

//GfxGradientRect( 180, 30, 1759, 735, ColorRGB(40,40,40), ColorRGB(0,0,40) );
GfxSetOverlayMode(1);
GfxSelectPen( ColorRGB(150,0,0), 1 );
GfxSelectSolidBrush( ColorRGB(0,0,40) );
GfxRectangle( 0,750, 1807, 35 );

GfxSelectPen( ColorRGB(150,0,0), 2 );
GfxSelectSolidBrush( ColorRGB(65,65,65) );
GfxPolygon(250,200,200,250,250,20,200,50);

//GfxSelectPen( ColorRGB(125,0,0), 1 );
//GfxSelectSolidBrush( ColorRGB(0,0,40) );
//GfxRectangle( 10,100, 190, 160 );

GfxSelectPen( ColorRGB(0,0,0), 1 );
GfxSelectSolidBrush( ColorRGB(0,0,0) );
//GfxSetTextAlign( 250 );// center alignment

GfxSetOverlayMode(1);
GfxSelectFont("Times New Roman", 40, 400, True );
GfxSetTextColor( ColorRGB( 105, 105, 105 ) );
GfxSetBkMode(0); // transparent
GfxTextOut("WIKI-101% PROFIT", 10 , 100 );


_SECTION_BEGIN("Flower");
si=Param("Zoom/In Out",5,-50,100,1);
GraphXSpace=si;

r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(155,155,155),IIf(m1>0 AND m1>s1,ColorRGB(0,125,0),IIf(m1>0 AND m1<s1,ColorRGB(180,30,160),ColorRGB(100,0,0))));

Prd1=Param("ATR Period",4,1,20,1);
Prd2=Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
flowerClose = EMA((Open+High+Low+Close)/4,3) ;
flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
Temp = Max(High, flowerOpen);
flowerHigh = EMA(Max(Temp, flowerClose),3);
Temp = Min(Low,flowerOpen);
flowerLow = EMA(Min(Temp, flowerClose),3);
barColor=IIf(Close>Open,ColorRGB(0,245,0),ColorRGB(255,0,0));
_SECTION_BEGIN("Support");

Prd2=Param("Sup_Period1",2,0,200,1);

test2 = TEMA ( Low , Prd2 ) ;

SP = Ref(test2,1) > Low AND test2 < Ref(test2,-1);//Peak
SPV0 = ValueWhen(SP,flowerLow,0);//PeakValue0
SPV1 = ValueWhen(SP,flowerLow,1);//PeakValue1
SPV2 = ValueWhen(SP,flowerLow,2);//PeakValue2

MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak

SpColor=ParamColor("SupColor",ColorRGB(0,225,0));
BrCount=Param("SupBarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor = colorBlack;
}


MSPV = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,1);
MSPD = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),1);
SD = IIf(DateNum() < LastValue(MSPD,lastmode = True ), Null, LastValue(MSPV,Lastmode = True));
Plot(SD,"Support1",SpColor,ParamStyle("SupportLine1",styleDashed|styleNoTitle,maskAll));

SpColor2=ParamColor("SupColor2",ColorRGB(0,200,0));
BrCount=Param("Sup2BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor2 = colorBlack;
}

MSPV2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,2);
MSPD2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),2);
SD2 = IIf(DateNum() < LastValue(MSPD2,lastmode = True ), Null, LastValue(MSPV2,Lastmode = True));
Plot(SD2,"Support2",Spcolor2,ParamStyle("SupportLine2",styleDashed|styleNoTitle,maskAll));

SpColor3=ParamColor("SupColor3",ColorRGB(0,175,0));
BrCount=Param("Sup3BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor3 = colorBlack;
}

MSPV3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,3);
MSPD3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),3);
SD3 = IIf(DateNum() < LastValue(MSPD3,lastmode = True ), Null, LastValue(MSPV3,Lastmode = True));
Plot(SD3,"Support3",SpColor3,ParamStyle("SupportLine3",styleThick|styleDots|styleNoTitle,maskAll));
_SECTION_END();


Title = StrFormat("\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " +WriteVal( V, 1.0 ) +", {{VALUES}}",
O, H, L, C, SelectedValue( ROC( C, 1 )) );

_SECTION_BEGIN("KPL Swing");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 11, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

messageboard = ParamToggle("Message Board","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

for(i=BarCount-1;i>1;i--)
{
if(Buy == 1)
{
entry = C;
sig = "BUY";
sl = s5d;
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell == 1)
{
sig = "SELL";
entry = C;
sl = s5d;
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount+3,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount+3,tar3,Null,Clr);

}


printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));

if (messageboard == 0 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 5, 7 ) ;
GfxTextOut( ( " <a href="#" id="_GPLITA_0" in_rurl="http://i.txtsrving.info/click?v=SU46NTk1MTg6MTM1MTp0cmFkaW5nOjIyZDM1YTlhZWQ1YmE0Njg4MmQ4Yzk1NzlhNjA3MWY4OnotMTc0OS01NDA5Njc6d3d3Lndpc2VzdG9ja3RyYWRlci5jb206MTgzMDU5OjIwZjc1MmY1MjRlZDlkMGJjNTU4ZjYyM2NiZWE1ZDE0OmExMDhlZGYwMzI4ZjQwOWVhOWMzZmVmOTkzOTE1OTlkOjA&subid=g-540967-951bf5f3abea4120b20173f8a6386f29-" title="Click to Continue > by costmin" style="background-color: transparent !important; border: none !important; display: inline-block !important; float: none !important; font-style: normal !important; font-variant: normal !important; font-weight: normal !important; font-size: 13px !important; line-height: 20px !important; font-family: monospace !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; vertical-align: baseline !important; width: auto !important; text-decoration: underline !important; background-position: initial initial !important; background-repeat: initial initial !important;">Trading<img src="http://cdncache1-a.akamaihd.net/items/it/img/arrow-10x10.png" style="background-color: transparent !important; border: none !important; display: inline-block !important; float: none !important; font-style: normal !important; font-variant: normal !important; font-weight: normal !important; font-size: 13px !important; line-height: 20px !important; font-family: monospace !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; vertical-align: super !important; width: 10px !important; background-position: initial initial !important; background-repeat: initial initial !important;"></a> System "),88,y-165);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120);
GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 88, y-22);;

}

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorWhite) );
Hor=Param("Horizontal Position",350,800,800,800);
Ver=Param("Vertical Position",50,27,27,27);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();

/*Plot EMA*/
Plot( EMA( Close,13), "13 EMA", colorRed,styleLine);
Plot( EMA( Close,34), "34 EMA", colorBlue,styleLine);
Plot( EMA( Close,55), "55 EMA", colorBlack,styleLine);
Plot( EMA( Close,89), "89 EMA", colorYellow,styleLine);


/////////////////////////////////////Kpl Swing
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//kpl swing formula here
//---- heikin ashi
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), .40);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("KPL Swing");
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

_SECTION_END();


////////////////////details of stock at the title

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

_SECTION_END();

/////////////////Stock near days high and low scanner
TimeFrameSet(inHourly);
H1 = HHV(H, 1) ;

H2= (H1-C)< .001*C;

L1 = LLV(L,1) ;


L2 = (C-L1) < .001*C ;

TimeFrameRestore() ;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);



Filter = H2 OR L2 ;

Buy = H2 ;
Sell = L2 ;




///////////////////////////candle stick reader
_SECTION_BEGIN("KPL Swing1");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

_SECTION_BEGIN("KPL Swing2");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 6, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();


_SECTION_BEGIN("KPL Swing3");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 3, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();


--------------------------------------------------------------------------
this my help so many people

any senior can help please ..........

some people are telling this is 101% sure AFL .....but how sure i don't know
 

TradeJoker

Well-Known Member
#2
PHP:
//GfxGradientRect( 180, 30, 1759, 735, ColorRGB(40,40,40), ColorRGB(0,0,40) ); 
GfxSetOverlayMode(1); 
GfxSelectPen( ColorRGB(150,0,0), 1 ); 
GfxSelectSolidBrush( ColorRGB(0,0,40) ); 
GfxRectangle( 0,750, 1807, 35 ); 

GfxSelectPen( ColorRGB(150,0,0), 2 ); 
GfxSelectSolidBrush( ColorRGB(65,65,65) ); 
GfxPolygon(250,200,200,250,250,20,200,50); 

//GfxSelectPen( ColorRGB(125,0,0), 1 ); 
//GfxSelectSolidBrush( ColorRGB(0,0,40) ); 
//GfxRectangle( 10,100, 190, 160 ); 

GfxSelectPen( ColorRGB(0,0,0), 1 ); 
GfxSelectSolidBrush( ColorRGB(0,0,0) ); 
//GfxSetTextAlign( 250 );// center alignment

GfxSetOverlayMode(1); 
GfxSelectFont("Times New Roman", 40, 400, True ); 
GfxSetTextColor( ColorRGB( 105, 105, 105 ) );
GfxSetBkMode(0); // transparent
GfxTextOut("WIKI-101% PROFIT", 10 , 100 ); 


_SECTION_BEGIN("Flower");
si=Param("Zoom/In Out",5,-50,100,1);
GraphXSpace=si; 

r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(155,155,155),IIf(m1>0 AND m1>s1,ColorRGB(0,125,0),IIf(m1>0 AND m1<s1,ColorRGB(180,30,160),ColorRGB(100,0,0))));

Prd1=Param("ATR Period",4,1,20,1);
Prd2=Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
flowerClose = EMA((Open+High+Low+Close)/4,3) ;
flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
Temp = Max(High, flowerOpen);
flowerHigh = EMA(Max(Temp, flowerClose),3);
Temp = Min(Low,flowerOpen);
flowerLow = EMA(Min(Temp, flowerClose),3);
barColor=IIf(Close>Open,ColorRGB(0,245,0),ColorRGB (255,0,0));
_SECTION_BEGIN("Support");

Prd2=Param("Sup_Period1",2,0,200,1);

test2 = TEMA ( Low , Prd2 ) ; 

SP = Ref(test2,1) > Low AND test2 < Ref(test2,-1);//Peak
SPV0 = ValueWhen(SP,flowerLow,0);//PeakValue0
SPV1 = ValueWhen(SP,flowerLow,1);//PeakValue1
SPV2 = ValueWhen(SP,flowerLow,2);//PeakValue2

MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak

SpColor=ParamColor("SupColor",ColorRGB(0,225,0));
BrCount=Param("SupBarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor[i] = colorBlack;
}


MSPV = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,1);
MSPD = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),1);
SD = IIf(DateNum() < LastValue(MSPD,lastmode = True ), Null, LastValue(MSPV,Lastmode = True));
Plot(SD,"Support1",SpColor,ParamStyle("SupportLine 1",styleDashed|styleNoTitle,maskAll));

SpColor2=ParamColor("SupColor2",ColorRGB(0,200,0)) ;
BrCount=Param("Sup2BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor2[i] = colorBlack;
}

MSPV2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,2);
MSPD2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),2);
SD2 = IIf(DateNum() < LastValue(MSPD2,lastmode = True ), Null, LastValue(MSPV2,Lastmode = True));
Plot(SD2,"Support2",Spcolor2,ParamStyle("SupportLi ne2",styleDashed|styleNoTitle,maskAll));

SpColor3=ParamColor("SupColor3",ColorRGB(0,175,0)) ;
BrCount=Param("Sup3BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor3[i] = colorBlack;
}

MSPV3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,3);
MSPD3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),3);
SD3 = IIf(DateNum() < LastValue(MSPD3,lastmode = True ), Null, LastValue(MSPV3,Lastmode = True));
Plot(SD3,"Support3",SpColor3,ParamStyle("SupportLi ne3",styleThick|styleDots|styleNoTitle,maskAll));
_SECTION_END();


Title = StrFormat("\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " +WriteVal( V, 1.0 ) +", {{VALUES}}",
O, H, L, C, SelectedValue( ROC( C, 1 )) );

_SECTION_BEGIN("KPL Swing");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 11, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

messageboard = ParamToggle("Message Board","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = s5d[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = s5d[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount+3,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount+3,tar3,Null,Clr);

}


printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));

if (messageboard == 0 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 5, 7 ) ;
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120);
GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 88, y-22);;

}

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorWhite) );
Hor=Param("Horizontal Position",350,800,800,800);
Ver=Param("Vertical Position",50,27,27,27);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();

/*Plot EMA*/
Plot( EMA( Close,13), "13 EMA", colorRed,styleLine);
Plot( EMA( Close,34), "34 EMA", colorBlue,styleLine);
Plot( EMA( Close,55), "55 EMA", colorBlack,styleLine);
Plot( EMA( Close,89), "89 EMA", colorYellow,styleLine);


/////////////////////////////////////Kpl Swing
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//kpl swing formula here
//---- heikin ashi
HaClose = (O+H+L+C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), .40); 
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) ); 
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("KPL Swing");
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

_SECTION_END();


////////////////////details of stock at the title

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

_SECTION_END();

/////////////////Stock near days high and low scanner
TimeFrameSet(inHourly);
H1 = HHV(H, 1) ;

H2= (H1-C)< .001*C;

L1 = LLV(L,1) ;


L2 = (C-L1) < .001*C ;

TimeFrameRestore() ;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);



Filter = H2 OR L2 ;

Buy = H2 ;
Sell = L2 ;




///////////////////////////candle stick reader
_SECTION_BEGIN("KPL Swing1");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

_SECTION_BEGIN("KPL Swing2");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 6, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();


_SECTION_BEGIN("KPL Swing3");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 3, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();
 

muinali

Well-Known Member
#3
sorry already done
 
#4
thank you tradejoker sir

such a fast and nice response
people like you always will help

because of you (like you) this site is very good place


now i am able to place this AFL in amibroker
surpricingly when i back test with this AFL it is not up to what i expected

you might come across so meny AFL's

i will be very thankful to you if you provide any good AFL for auto trading .......
 
#5
Try this

//GfxGradientRect( 180, 30, 1759, 735, ColorRGB(40,40,40), ColorRGB(0,0,40) );
GfxSetOverlayMode(1);
GfxSelectPen( ColorRGB(150,0,0), 1 );
GfxSelectSolidBrush( ColorRGB(0,0,40) );
GfxRectangle( 0,750, 1807, 35 );

GfxSelectPen( ColorRGB(150,0,0), 2 );
GfxSelectSolidBrush( ColorRGB(65,65,65) );
GfxPolygon(250,200,200,250,250,20,200,50);

//GfxSelectPen( ColorRGB(125,0,0), 1 );
//GfxSelectSolidBrush( ColorRGB(0,0,40) );
//GfxRectangle( 10,100, 190, 160 );

GfxSelectPen( ColorRGB(0,0,0), 1 );
GfxSelectSolidBrush( ColorRGB(0,0,0) );
//GfxSetTextAlign( 250 );// center alignment

GfxSetOverlayMode(1);
GfxSelectFont("Times New Roman", 40, 400, True );
GfxSetTextColor( ColorRGB( 105, 105, 105 ) );
GfxSetBkMode(0); // transparent
GfxTextOut("WIKI-101% PROFIT", 10 , 100 );


_SECTION_BEGIN("Flower");
si=Param("Zoom/In Out",5,-50,100,1);
GraphXSpace=si;

r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(155,155,155),IIf(m1>0 AND m1>s1,ColorRGB(0,125,0),IIf(m1>0 AND m1<s1,ColorRGB(180,30,160),ColorRGB(100,0,0))));

Prd1=Param("ATR Period",4,1,20,1);
Prd2=Param("Look Back",7,1,20,1);
green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
flowerClose = EMA((Open+High+Low+Close)/4,3) ;
flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
Temp = Max(High, flowerOpen);
flowerHigh = EMA(Max(Temp, flowerClose),3);
Temp = Min(Low,flowerOpen);
flowerLow = EMA(Min(Temp, flowerClose),3);
barColor=IIf(Close>Open,ColorRGB(0,245,0),ColorRGB (255,0,0));
_SECTION_BEGIN("Support");

Prd2=Param("Sup_Period1",2,0,200,1);

test2 = TEMA ( Low , Prd2 ) ;

SP = Ref(test2,1) > Low AND test2 < Ref(test2,-1);//Peak
SPV0 = ValueWhen(SP,flowerLow,0);//PeakValue0
SPV1 = ValueWhen(SP,flowerLow,1);//PeakValue1
SPV2 = ValueWhen(SP,flowerLow,2);//PeakValue2

MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak

SpColor=ParamColor("SupColor",ColorRGB(0,225,0));
BrCount=Param("SupBarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor = colorBlack;
}


MSPV = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,1);
MSPD = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),1);
SD = IIf(DateNum() < LastValue(MSPD,lastmode = True ), Null, LastValue(MSPV,Lastmode = True));
Plot(SD,"Support1",SpColor,ParamStyle("SupportLine 1",styleDashed|styleNoTitle,maskAll));

SpColor2=ParamColor("SupColor2",ColorRGB(0,200,0)) ;
BrCount=Param("Sup2BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor2 = colorBlack;
}

MSPV2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,2);
MSPD2 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),2);
SD2 = IIf(DateNum() < LastValue(MSPD2,lastmode = True ), Null, LastValue(MSPV2,Lastmode = True));
Plot(SD2,"Support2",Spcolor2,ParamStyle("SupportLi ne2",styleDashed|styleNoTitle,maskAll));

SpColor3=ParamColor("SupColor3",ColorRGB(0,175,0)) ;
BrCount=Param("Sup3BarLength",8,1,500,1);
for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
{
SpColor3 = colorBlack;
}

MSPV3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,3);
MSPD3 = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),3);
SD3 = IIf(DateNum() < LastValue(MSPD3,lastmode = True ), Null, LastValue(MSPV3,Lastmode = True));
Plot(SD3,"Support3",SpColor3,ParamStyle("SupportLi ne3",styleThick|styleDots|styleNoTitle,maskAll));
_SECTION_END();


Title = StrFormat("\\c02 {{NAME}} | {{DATE}} | Open : %g | High : %g | Low : %g | Close : %g | Change = %.1f%% | Volume = " +WriteVal( V, 1.0 ) +", {{VALUES}}",
O, H, L, C, SelectedValue( ROC( C, 1 )) );

_SECTION_BEGIN("KPL Swing");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 11, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

messageboard = ParamToggle("Message Board","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
no=10;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
s5d=IIf(avn==1,sup,res);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

if (showsl == 0)
//{Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
exitlong = Cross(s5d, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, s5d);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);

Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

for(i=BarCount-1;i>1;i--)
{
if(Buy == 1)
{
entry = C;
sig = "BUY";
sl = s5d;
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell == 1)
{
sig = "SELL";
entry = C;
sl = s5d;
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);


bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount+1,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount+3,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount+3,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount+3,tar3,Null,Clr);

}


printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));

if (messageboard == 0 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 5, 7 ) ;
//GfxTextOut( ( " <ahref="#" id="_GPLITA_0" in_rurl="http://i.txtsrving.info/click?v=SU46NTk1MTg6MTM1MTp0cmFkaW5nOjIyZDM1YTlhZW Q1YmE0Njg4MmQ4Yzk1NzlhNjA3MWY4OnotMTc0OS01NDA5Njc6 d3d3Lndpc2VzdG9ja3RyYWRlci5jb206MTgzMDU5OjIwZjc1Mm Y1MjRlZDlkMGJjNTU4ZjYyM2NiZWE1ZDE0OmExMDhlZGYwMzI4 ZjQwOWVhOWMzZmVmOTkzOTE1OTlkOjA&subid=g-540967-951bf5f3abea4120b20173f8a6386f29-" title="Click to Continue > by costmin" style="background-color: transparent !important; border: none !important; display: inline-block !important; float: none !important; font-style: normal !important; font-variant: normal !important; font-weight: normal !important; font-size: 13px !important; line-height: 20px !important; font-family: monospace !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; vertical-align: baseline !important; width: auto !important; text-decoration: underline !important; background-position: initial initial !important; background-repeat: initial initial !important;">Trading<img src="http://cdncache1-a.akamaihd.net/items/it/img/arrow-10x10.png" style="background-color: transparent !important; border: none !important; display: inline-block !important; float: none !important; font-style: normal !important; font-variant: normal !important; font-weight: normal !important; font-size: 13px !important; line-height: 20px !important; font-family: monospace !important; height: 10px !important; margin: 0px 0px 0px 3px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; vertical-align: super !important; width: 10px !important; background-position: initial initial !important; background-repeat: initial initial !important;"></a> System "),88,y-165);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-140) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-120);
GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 88, y-22);;

}

_SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,30,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorWhite) );
Hor=Param("Horizontal Position",350,800,800,800);
Ver=Param("Vertical Position",50,27,27,27);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();

/*Plot EMA*/
Plot( EMA( Close,13), "13 EMA", colorRed,styleLine);
Plot( EMA( Close,34), "34 EMA", colorBlue,styleLine);
Plot( EMA( Close,55), "55 EMA", colorBlack,styleLine);
Plot( EMA( Close,89), "89 EMA", colorYellow,styleLine);


/////////////////////////////////////Kpl Swing
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//kpl swing formula here
//---- heikin ashi
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), .40);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("KPL Swing");
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

_SECTION_END();


////////////////////details of stock at the title

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

_SECTION_END();

/////////////////Stock near days high and low scanner
TimeFrameSet(inHourly);
H1 = HHV(H, 1) ;

H2= (H1-C)< .001*C;

L1 = LLV(L,1) ;


L2 = (C-L1) < .001*C ;

TimeFrameRestore() ;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);



Filter = H2 OR L2 ;

Buy = H2 ;
Sell = L2 ;




///////////////////////////candle stick reader
_SECTION_BEGIN("KPL Swing1");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 10, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

_SECTION_BEGIN("KPL Swing2");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 6, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();


_SECTION_BEGIN("KPL Swing3");
//Copyright Kamalesh Langote. Email:[email protected]. More details at http://www.vfmdirect.com/kplswing
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 3, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();

_SECTION_BEGIN("Chart Colors");
SetChartBkColor(ParamColor("Background Color",ColorRGB(0,0,0)));
//SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color",
colorYellow),IIf(C<=O,ParamColor("Candle Down Color",
colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Wick UP Color",
colorYellow),IIf(C<=O,ParamColor("Wick Down Color",
colorRed),colorLightGrey)),64,0,0,0,0);
_SECTION_END();
 

TradeJoker

Well-Known Member
#6
Dear Dr.Ravi,

i've many afl, most of from traderji and wisestocktrader,after analysing many afls,i understood all these afl available freely bcos the owner of the afl made losses with it :D there is no special magic in these afls :D

thank you tradejoker sir

such a fast and nice response
people like you always will help

because of you (like you) this site is very good place


now i am able to place this AFL in amibroker
surpricingly when i back test with this AFL it is not up to what i expected

you might come across so meny AFL's

i will be very thankful to you if you provide any good AFL for auto trading .......
 
#7
thank you tradejoker sir

i too having the same feeling ........but optimist in me will not stop searching for good AFL 's

your saying (all these free AFL ), means some better AFL available for cost

if it is so .....here i am ready to pay, if it is really good (at least better) because i believe there should be some value for others hard work

so .....if any body having please let me know ......because i am in need

i know this site is not for business (selling and buying AFL's or stratagies )but my need is such a bad thing ....

sorry if i am wrong
 
#8
venkat babu sir

thank you for the above AFL given by you ........
when i plot this in amibroker it is giving error

error 31
syntax error
may be this is having some small correction which i am not able to correct it
can you please tell me how to get out of that error
 

madhavareddy1203

Well-Known Member
#9
Suggestion to all people:

We already serched.... backtested... used more than 1000s of afls.. and sit whole nights for better tunesc.. and combination of different indicators........ etc..

Finally i got conclusion........ this is waste of time.. nd there is no thing like that.

We are trading by seeing past values and past actions. Who told past actions will repeat in same way.

Think about future.. learn future trading.. not read past values.

So guys.... pLz dont waste ur time by working on afls.......

Already one guy told: Indicators means which happend in past.. these not suggesting future..... only 40% chances to happen.... not sure.
 
#10
yes may be you are absolutely right ,Madhava reddy

but how can we go with out any tool in the market
it is our hard earned money

at least the tool may give some hint regarding trend ,,and direction
so that we will decide to stay in market or be away

and all research and hard work of seniors and genius people ....can give some hint in the form of tools

what i mean to say is at least it will protect our money from unforeseen market conditions

yes .....really so many people here .spent so much of time on this

i am happy to meet such a group of people who help each other ....and freely deliver their views

thank you
 

Similar threads