Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Fibonacci Retracements fixed to 12.5% for Amibroker (AFL)

Rating:
0 / 5 (Votes 0)
Tags:
amibroker, fibonacci, study

This great code was created by Panos on the amibroker forums. It allows you to plot fib retracements at 12.5% increments. To use it you need to draw a trendline from the high point where you want the fib retracements to start to a low point. Next you need to select the trendline and go to properties and set the ‘Study ID’ to ‘P1’. Once done you should see the fib retracements plotted. You can check out the full forum post here

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("xFibo_with_Color_fixed");
/** Fibonacci Retracements fixed to 12.5%
// 12.5%, 25%, 37.5%, 50%, 62.5%, 75%, 87.5%
// By Panos Version 1   21-Oct-2017  xFibo with GfxLines
// example = xFibo("F1",colorYellow, 150 );
/// @link http://forum.amibroker.com/t/extension-or-retracement-formula-required/2682/3
/// foto @link http://tinyurl.com/ycupqekg
*/

Plot( C, "", colorDefault, styleCandle );

GfxSetOverlayMode( 1 );
GfxSetCoordsMode( 1 ); // bar/price mode (instead of pixel)

function  xFibo( StudyID, Color, extend )
{
    trendline = Study( StudyID, GetChartID() );

    X1 = StartX = LastValue( ValueWhen( ExRem( trendline, 0 ), BarIndex() ) );
    X2 = EndX = LastValue( ValueWhen( trendline, BarIndex() ) );		//	printf("X1 StartX  = %g,\n X2 EndX = %g\n", StartX, EndX );
    Y1 = StartY = LastValue( ValueWhen( ExRem( trendline, 0 ), trendline ) );
    Y2 = EndY = LastValue( ValueWhen( trendline, trendline ) );			//	printf("\nY1 StartY  = %g,\nY2  EndY = %g\n", StartY, EndY );

    DiffY = ( Y2 - Y1 ) ;
    GfxSelectPen( Color );

    // Show me the lines 12.5%, 25%, 37.5%, 50%, 62.5%, 75%, 87.5%, 100%
    for( i = 0; i <= 1 ; i = i + 0.125 )
    {
       // printf( "\n i " + i );
        lineY = Y2 - ( DiffY * i );
        GfxMoveTo( StartX, lineY );  GfxLineTo( EndX + extend , lineY );
    }
}

extend= Param("Extent Lines", 0, -200, 200,10 );
xFibo("P1",colorDarkOliveGreen, extend ) ;
xFibo("P2",colorBlueGrey, extend);
xFibo("P3",colorAqua,extend);
_SECTION_END();

1 comments

1. t.viswanath

not working

Leave Comment

Please login here to leave a comment.

Back