Santosh ji Please add TSL in this Heikin Ashi AFL...
//------------------------------------------------------------------------------
//
// Formula Name: INTRADAY HEIKIN ASHI new
// Author/Uploader: ali
// Keywords: INTRADAY HEIKIN ASHI new
// Level: advanced
// Flags: system
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
A=BBandTop( P, Periods, Width );
B=BBandBot( P, Periods, Width );
bmid=(a+b)/2;
//Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorWhite, style);
//Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorWhite, style);
_SECTION_END();
_SECTION_BEGIN("Plot BUY SELL");
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.25 * ATR( 50 );
for ( i = 0; i < BarCount; i++ )
{
if ( HH )
PlotText( "S", i, H[ i ] + dist, colorYellow );
if ( LH )
PlotText( "S", i, H[ i ] + dist, colorRed );
if ( HL )
PlotText( "B", i, L[ i ] - dist, colorDarkYellow );
if ( LL )
PlotText( "B", i, L[ i ] - dist, colorCustom9 );
}
_SECTION_END();
//Magfied Market Price
FS=Param("Font Size",30,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBrightGreen) );
Hor=Param("Horizontal Position",590,1,1200,1);
Ver=Param("Vertical Position",12,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 );
_SECTION_END();
//---- heikin ashi
HaClose = (a+b+bmid)/3;
HaOpen = AMA( Ref( HaClose, -1 ), 0.3 );
HaHigh = Max( a, Max( HaClose, HaOpen ) );
HaLow = Min( b, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
barcolor = IIf(HaClose >= HaOpen,colorBrightGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleThick|styleCandle );
//------------------------------------------------------------------------------
//
// Formula Name: INTRADAY HEIKIN ASHI new
// Author/Uploader: ali
// Keywords: INTRADAY HEIKIN ASHI new
// Level: advanced
// Flags: system
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
A=BBandTop( P, Periods, Width );
B=BBandBot( P, Periods, Width );
bmid=(a+b)/2;
//Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorWhite, style);
//Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorWhite, style);
_SECTION_END();
_SECTION_BEGIN("Plot BUY SELL");
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.25 * ATR( 50 );
for ( i = 0; i < BarCount; i++ )
{
if ( HH )
PlotText( "S", i, H[ i ] + dist, colorYellow );
if ( LH )
PlotText( "S", i, H[ i ] + dist, colorRed );
if ( HL )
PlotText( "B", i, L[ i ] - dist, colorDarkYellow );
if ( LL )
PlotText( "B", i, L[ i ] - dist, colorCustom9 );
}
_SECTION_END();
//Magfied Market Price
FS=Param("Font Size",30,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorBrightGreen) );
Hor=Param("Horizontal Position",590,1,1200,1);
Ver=Param("Vertical Position",12,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 );
_SECTION_END();
//---- heikin ashi
HaClose = (a+b+bmid)/3;
HaOpen = AMA( Ref( HaClose, -1 ), 0.3 );
HaHigh = Max( a, Max( HaClose, HaOpen ) );
HaLow = Min( b, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
barcolor = IIf(HaClose >= HaOpen,colorBrightGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleThick|styleCandle );