Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Point & figure Chart India Securities
Author/Uploader: Mandeep Singh - man4urheart [at] yahoo.com
Date/Time added: 2009-01-05 16:11:16
Origin: Found this AFL on Internet. Using it for my analyses Sharing same.
Keywords:
Level: advanced
Flags: indicator

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

_SECTION_BEGIN( \"Point & Figure w Values adj\" );
//mandeep Singh 05-Jan-2009
GfxSetBkColor(colorBlack);
GfxSetTextColor( colorOrange );
GfxSelectFont(\"Times New Roman\", 10, 700, True );
GfxTextOut(\"man4urheart.blogspot.com\", 10 , 0 );

GraphXSpace = 5;

SetChartBkColor( ParamColor( \"BackGroundColor\", colorBlack) );

//GraphColor = ParamColor(\"GarphColor\",colorLightGrey);

GridColor = ParamColor( \"GridColor\", colorLightGrey );

Scaling = ParamList( \"Scaling Method\", \"Traditional|Percentage|AVG True Range\" );

if ( scaling == \"Traditional\" )
{
Box = Param( \"Box\", 1, 0.2, 100, 0.1 );

}
else

if ( scaling == \"Percentage\" )
Box = Param( \"Box \", 1, 0.2, 10, 0.1 ) / 100 * LastValue( C );
else
if ( scaling == \"AVG True Range\" )
Box = Param( \"Box\", 1, 0.3, 5, 0.1 ) * LastValue( ATR ( 20 ) );

shiftChart = 0;
shiftLastClose = 1;
shiftGrid = 7;
shiftPriceAxis = 2;

Reverse = Param( \"Reverse\", 3, 1, 5 );

j = 0;

PFL[0] = Box * ceil( Low[0] / Box ) + Box;

PFH[0] = Box * floor( High[0] / Box );

direction = 0;

for ( i = 1; i < BarCount; i++ )

{

if ( direction[j] == 0 )

{

if ( Low[i] <= PFL[j] - Box )

{

PFL[j] = Box * ceil( Low[i] / Box );

}

else

{

if ( High[i] >= PFL[j] + Reverse*Box )

{

j++;

direction[j] = 1;

PFH[j] = Box * floor( High[i] / Box );

PFL[j] = PFL[j - 1] + Box;

}

}

}

else

{

if ( High[i] >= PFH[j] + Box )

{

PFH[j] = Box * floor( High[i] / Box );

}

else

{

if ( Low[i] <= PFH[j] - Reverse * Box )

{

j++;

direction[j] = 0;

PFH[j] = PFH[j - 1] - Box;

PFL[j] = Box * ceil( Low[i] / Box );

}

}

}

}

delta = BarCount - j - 1;

direction = Ref( direction, - delta );

Hi = Ref( PFH, -delta ) + Box / 2;

Lo = Ref( PFL, -delta ) - Box / 2;

Cl = IIf( direction == 1, Hi, Lo );

Op = IIf( direction == 1, Cl - Box, Cl + Box );

Graphcolor = IIf( direction == 1, ParamColor( \"X_Color\",colorBrightGreen ),

ParamColor( \"O_Color\", colorRed ) );

PlotOHLC( Op, Hi, Lo, Cl, \"\", GraphColor , stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

PlotOHLC( Op, Hi, Lo, Cl, \"\", GraphColor , stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

Last = Ref( LastValue( C ), -( BarCount - 1 ) );

Plot( Last, \"\", colorRed, styleNoLine | styleDots, 0 , 0,shiftLastClose );

// selected value

Value = IIf( direction > 0, SelectedValue( Hi ) - box / 2,SelectedValue( Lo ) + box / 2 );


//----------------------------------------------------------

// GRID CONSTRUCTION

//----------------------------------------------------------

PlotGridLines = ParamToggle( \"PlotdGrid\", \"Yes! |No\", 1 ) ;

if ( PlotGridLines ==1)

{

begin = SelectedValue( BarIndex() );

end = LastValue( BarIndex() );

period = end - begin + 1;

if ( begin < end )

{

ScreenHigh = LastValue( HHV( cl, period ) );

ScreenLow = LastValue( LLV( Cl, period ) );

top = LineArray( begin - shiftGrid, screenHigh, end, screenhigh, 0 ,
1 );

Bot = LineArray( begin - shiftGrid, screenlow, end, screenLow, 0, 1 );

Plot( top, \"\", gridColor, styleLine | styleNoLabel , 0, 0, shiftGrid );

//Plot( bot, \"\", gridColor,styleLine|styleNoLabel, 0 , 0 , shiftGrid);

VerticalGrid = IIf ( BarIndex() >= begin, IIf( direction == 1,
screenHigh,
screenLow ), Null );

Plot ( VerticalGrid, \"\", gridColor, styleStaircase | styleNoLabel,
0, 0, 1
);

format = 8.2;

for ( n = LastValue( bot ); n < LastValue( top ) - 0.5*box; n = n +
box )

{

Plot( bot , \"\", gridColor, styleLine | styleNoLabel, 0, 0 , shiftGrid );

text = NumToStr( LastValue( bot ) + 0.5 * box, format );

xposition = BarCount + shiftPriceaxis;

yPosition = LastValue( bot ) + 0.27 * box;

PlotText( text, xPosition , yPosition, colorWhite );

bot = bot + box;

Graphcolor = IIf( direction == 1, ParamColor( \"X_Color\",
colorBrightGreen ),

ParamColor( \"O_Color\", colorRed ) );

PlotOHLC( Op, Hi, Lo, Cl, \"\", GraphColor , stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

}

}

}



//----------------------------------------------------------

// TITLE

//----------------------------------------------------------

Title = \"\\n\" +

\" Instrument : \" + Name() + FullName() + \"\\n \" +

\"Formula : \" + \" Point & Figure (High/Low Range)\" + \"\\n \" +

\"Box : \" + NumToStr( Box, 4.4 ) + \" \" +

\"Reverse : \" + NumToStr( Reverse, 2.0 ) + \"\\n \" +

\"ATR : \" + WriteVal( LastValue( ATR( 100 ) ), format = 4.4 );

_SECTION_END();




Formula:

_SECTION_BEGIN( "Point & Figure w Values adj" );
//mandeep Singh 05-Jan-2009

GfxSetBkColor(colorBlack);
GfxSetTextColor( colorOrange ); 
GfxSelectFont("Times New Roman", 10, 700, True );
GfxTextOut("man4urheart.blogspot.com", 10 , 0 );
 
GraphXSpace = 5;

SetChartBkColor( ParamColor( "BackGroundColor", colorBlack) );

//GraphColor = ParamColor("GarphColor",colorLightGrey);
 
GridColor = ParamColor( "GridColor", colorLightGrey );
 
Scaling = ParamList( "Scaling Method", "Traditional|Percentage|AVG True Range"
);
 
if ( scaling == "Traditional" )
 {
Box = Param( "Box", 1, 0.2, 100, 0.1 );

 }
else
 
if ( scaling == "Percentage" )
	Box = Param( "Box ", 1, 0.2, 10, 0.1 ) / 100 * LastValue( C );
else
if ( scaling == "AVG True Range" )
Box = Param( "Box", 1, 0.3, 5, 0.1 ) * LastValue( ATR ( 20 ) );

shiftChart = 0;
shiftLastClose = 1;
shiftGrid = 7;
shiftPriceAxis = 2;
 
Reverse = Param( "Reverse", 3, 1, 5 );
 
j = 0;
 
PFL[0] = Box * ceil( Low[0] / Box ) + Box;
 
PFH[0] = Box * floor( High[0] / Box );
 
direction = 0;
 
 for ( i = 1; i < BarCount; i++ )
 
 {
 
if ( direction[j] == 0 )
 
 {
 
 if ( Low[i] <= PFL[j] - Box )
 
 {
 
 PFL[j] = Box * ceil( Low[i] / Box );
 
 }
 
 else
 
 {
 
 if ( High[i] >= PFL[j] + Reverse*Box )
 
 {
 
 j++;
 
 direction[j] = 1;
 
 PFH[j] = Box * floor( High[i] / Box );
 
 PFL[j] = PFL[j - 1] + Box;
 
 }
 
 }
 
}

 else
 
 {
 
 if ( High[i] >= PFH[j] + Box )
 
 {
 
 PFH[j] = Box * floor( High[i] / Box );
 
 }
 
 else
 
 {
 
 if ( Low[i] <= PFH[j] - Reverse * Box )
 
 {
 
 j++;
 
 direction[j] = 0;
 
 PFH[j] = PFH[j - 1] - Box;
 
 PFL[j] = Box * ceil( Low[i] / Box );
 
 }
 
 }
 
 }
 
 }
 
 delta = BarCount - j - 1;
 
 direction = Ref( direction, - delta );
 
 Hi = Ref( PFH, -delta ) + Box / 2;
 
 Lo = Ref( PFL, -delta ) - Box / 2;
 
 Cl = IIf( direction == 1, Hi, Lo );
 
 Op = IIf( direction == 1, Cl - Box, Cl + Box );
 
 Graphcolor = IIf( direction == 1, ParamColor( "X_Color",colorBrightGreen ),
 
 ParamColor( "O_Color", colorRed ) );
 
 PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor , stylePointAndFigure | styleNoLabel,
0, 0 , shiftChart );
 
 PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor , stylePointAndFigure | styleNoLabel,
0, 0 , shiftChart );
 
 Last = Ref( LastValue( C ), -( BarCount - 1 ) );
 
 Plot( Last, "", colorRed, styleNoLine | styleDots, 0 , 0,shiftLastClose );
 
 // selected value
 
 Value = IIf( direction > 0, SelectedValue( Hi ) - box / 2,SelectedValue( Lo )
+ box / 2 );
 

//----------------------------------------------------------
 
 // GRID CONSTRUCTION
 
 //----------------------------------------------------------
 
 PlotGridLines = ParamToggle( "PlotdGrid", "Yes! |No", 1 ) ;
 
 if ( PlotGridLines ==1)
 
 {
 
 begin = SelectedValue( BarIndex() );
 
 end = LastValue( BarIndex() );
 
 period = end - begin + 1;
 
 if ( begin < end )
 
 {
 
 ScreenHigh = LastValue( HHV( cl, period ) );
 
 ScreenLow = LastValue( LLV( Cl, period ) );
 
 top = LineArray( begin - shiftGrid, screenHigh, end, screenhigh, 0 ,
1 );
 
 Bot = LineArray( begin - shiftGrid, screenlow, end, screenLow, 0, 1 );
 
 Plot( top, "", gridColor, styleLine | styleNoLabel , 0, 0, shiftGrid );
 
 //Plot( bot, "", gridColor,styleLine|styleNoLabel, 0 , 0 , shiftGrid);
 
 VerticalGrid = IIf ( BarIndex() >= begin, IIf( direction == 1,
screenHigh,
 screenLow ), Null );
 
 Plot ( VerticalGrid, "", gridColor, styleStaircase | styleNoLabel,
0, 0, 1
 );
 
 format = 8.2;
 
 for ( n = LastValue( bot ); n < LastValue( top ) - 0.5*box; n = n +
box )
 
 {

 Plot( bot , "", gridColor, styleLine | styleNoLabel, 0, 0 , shiftGrid );
 
 text = NumToStr( LastValue( bot ) + 0.5 * box, format );
 
 xposition = BarCount + shiftPriceaxis;
 
 yPosition = LastValue( bot ) + 0.27 * box;
 
 PlotText( text, xPosition , yPosition, colorWhite );
 
 bot = bot + box;
 
 Graphcolor = IIf( direction == 1, ParamColor( "X_Color",
colorBrightGreen ),
 
 ParamColor( "O_Color", colorRed ) );
 
 PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor , stylePointAndFigure | styleNoLabel,
0, 0 , shiftChart );
 
 }
 
 }
 
 }
 
 
 
 //----------------------------------------------------------
 
 // TITLE
 
 //----------------------------------------------------------
 
 Title = "\n" +
 
 " Instrument : " + Name() + FullName() + "\n " +
 
"Formula : " + " Point & Figure (High/Low Range)" + "\n " +
 
 "Box : " + NumToStr( Box, 4.4 ) + " " +
 
 "Reverse : " + NumToStr( Reverse, 2.0 ) + "\n " +
 
 "ATR : " + WriteVal( LastValue( ATR( 100 ) ), format = 4.4 );
 
 _SECTION_END();
 
 


 

Comments:


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM