// Downloaded From https://www.WiseStockTrader.com _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();