Excellent Swing Trading System for Amibroker

This Swing Trading System AFL for Amibroker is Excellent for positional and Intraday Trading. This gives better results for NSE Futures and MCX Commodity. Recommended timeframes are 15Min to 60Min either for intraday or positional trading. .

Download Swing Trading System AFL for Amibroker

AmiTrader

COPY & PASTE CODE :

//Swing Trading
SetBarsRequired(1000);
BarLum1         = Param(“Bar Color Intensity”, 8, 0, 10,01);
UpBarColor        = ColorBlend(ColorRGB(5,36,5), ColorRGB(10,75,10), BarLum1);
DnBarColor        = ColorBlend(ColorRGB(36,5,5), ColorRGB(75,10,10), BarLum1);
BarColor        = IIf(Close > Open, UpBarColor, DnBarColor);
SetBarFillColor(BarColor);
stylecndl=ParamList(“Bar or Candle chart?”,”Bar|Candle”);
Showboll=ParamList(“Show Bollinger Bands”,”Yes|No”);

if (stylecndl==”Bar”)stylec=styleBar;
else stylec=styleCandle;

Plot(C,”close”,colorWhite,stylec);
tline=tlinebs=barhi=barlo=beglo=beghi=endi=begi=0;
for (i=1;i<BarCount;i++)
{

if (i>=4)
{

if (H[i]>H[i-1]AND H[i-1]>H[i-2] AND i>beglo)
{
tline[i]=H[i];
barhi=1;
barlo=0;
prevhi=beghi;
beghi=i;
}
if (L[i]<L[i-1]AND L[i-1]<L[i-2] AND i>beghi)
{
tline[i]=L[i];
barlo=1;
barhi=0;
prevlo=beglo;
beglo=i;
}
}

if (i==beglo)
{
if (prevlo>beghi)
{
begi=prevlo; begval=L[prevlo];
endi=beglo;endval=L[beglo];
}
else if (beghi>prevlo)
{
begi=beghi; begval=H[beghi];
endi=beglo;endval=L[beglo];
}
}
if (i==beghi)
{
if (prevhi>beglo)
{
begi=prevhi; begval=H[prevhi];
endi=beghi;endval=H[beghi];
}
else if (beglo>prevhi)
{
begi=beglo; begval=L[beglo];
endi=beghi;endval=H[beghi];
}
}

if (endi-begi>1)
{
incr=(endval-begval)/(endi-begi);
for (j=begi;j<=endi;j++)
{
tline[j]=begval+(j-begi)*incr;
}
}

if (tline[i]==0)tline[i]=Null;
}
tline=IIf(tline>0,tline,Null);
Plot(tline,”Trendline”,colorWhite,styleLine);

if (showboll==”Yes”)
{

}

Q = Param( “% Change”, 2, 0.1, 10, 0.1 );
Z = Zig( C , q ) ;
HH = ( ( Z < Ref( Z, -1 ) AND Ref( Z, -1 ) > Ref( Z, -2 ) ) AND (Peak( z, q, 1 ) > Peak( Z, q, 2 ) ) );
LH = ( ( Z < Ref( Z, -1 ) AND Ref( Z, -1 ) > Ref( Z, -2 ) ) AND (Peak( Z, q, 1 ) < Peak( Z, q, 2 ) ) );
HL = ( ( Z > Ref( Z, -1 ) AND Ref( Z, -1 ) < Ref( Z, -2 ) ) AND (Trough( Z, q, 1 ) > Trough( Z, q, 2 ) ) );
LL = ( ( Z > Ref( Z, -1 ) AND Ref( Z, -1 ) < Ref( Z, -2 ) ) AND (Trough( Z, q, 1 ) < Trough( Z, q, 2 ) ) );
GraphXSpace = 5;
dist = 0.5 * ATR( 20 );

for ( i = 0; i < BarCount; i++ )
{
if ( HH[i] )
PlotText( “HH”, i, H[ i ] + dist[i], colorYellow );

if ( LH[i] )
PlotText( “LH”, i, H[ i ] + dist[i], colorYellow );

if ( HL[i] )
PlotText( “HL”, i, L[ i ] – dist[i], colorPink );

if ( LL[i] )
PlotText( “LL”, i, L[ i ] – dist[i], colorPink );

}

//Code Ends Here.

NOTE : Most formulas, oscillators, indicators and systems have been downloaded from internet being freely available and edited for convenience or submitted by anonymous users. Therefore www.TechArticles.in does not take any responsibility for it’s quality. If you use any of this information, use it at your own risk. You are responsible for your own trading decisions. Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade. In no case will TechArticles.in be responsible for your trading gains or losses.