Brooky_FibIt_Retracement_Script

Download script
Author: Copyright 2012, www.Brooky_Indicators.com
Brooky_FibIt_Retracement_Script

The Brooky Fibonacci Retracement Script is a specialized automation tool designed for MetaTrader 4 users who want to quickly and accurately plot Fibonacci retracement levels on their trading charts. Instead of manually dragging and adjusting lines, this script automates the placement and labeling of these key technical analysis markers.

Core Functionality

The primary purpose of this script is to simplify chart setup by automatically identifying a specific price range and drawing a Fibonacci retracement tool based on historical price data. It focuses on a set timeframe—specifically looking back at the movement between the high and low points of previous candles—to establish a clear visual map of potential support and resistance zones.

How the Logic Works

When executed, the script follows a structured sequence to organize your workspace:

  • Automated Data Selection: The tool automatically identifies two critical points in time and price: the peak (High) and the valley (Low). It uses these coordinates to define the "swing" of the market, ensuring that the Fibonacci levels are anchored to actual historical price action.
  • Customizable Visualization: The script allows you to tailor the look of the tool to match your personal trading style. You can define:
    • The color and thickness of the main bars.
    • The visual style (solid, dashed, etc.) of both the main bars and the individual levels.
    • The specific colors for the level lines to ensure they stand out against your chart background.
  • Dynamic Level Configuration: Unlike standard tools that only show default numbers, this script allows for a high degree of customization regarding the Fibonacci ratios themselves. You can define seven distinct levels (such as 0.236, 0.382, 0.5, etc.) to match your specific trading strategy.
  • Intelligent Labeling: One of the standout features is the descriptive labeling system. The script automatically generates text descriptions for each level. For example, it can label levels as "Extreme," "Break OUT," "Break IN," or "Centre." These labels are combined with the actual price value (e.g., "Centre @ $1.234"), providing you with immediate context on what each zone represents without requiring manual annotation.

Key Benefits for Traders

  • Speed and Consistency: By removing the manual "click-and-drag" process, the script ensures that your Fibonacci levels are placed consistently every time you run it.
  • Clutter Reduction: The script manages the creation of the object, automatically cleaning up previous instances to keep your chart organized and professional.
  • Enhanced Clarity: With custom descriptions attached directly to the price points, you can identify high-probability reversal or continuation zones at a single glance.
11 Views
0 Downloads
0 Favorites
Brooky_FibIt_Retracement_Script
//+------------------------------------------------------------------+
//|                              Brooky_FibIt_Retracement_Script.mq4 |
//|                        Copyright 2012, www.Brooky_Indicators.com |
//|                                        www.Brooky_Indicators.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, www.Brooky_Indicators.com"
#property link      "www.Brooky_Indicators.com"
#property show_confirm  
#property show_inputs
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+

extern int       FibOnChartNum =1;

extern color     Fib_Cbar_Color = Red;
extern int       Fib_Cbar_Size=1;
extern int       Fib_Cbar_Style=2;

extern color     Fib_Level_Color = Gray;
extern int       Fib_Level_Size=1;
extern int       Fib_Level_Style=2;

extern double     Fib_Level_1 = 0;
extern double     Fib_Level_2 = 0.236;
extern double     Fib_Level_3 = 0.382;
extern double     Fib_Level_4 = 0.5;
extern double     Fib_Level_5 = 0.618;
extern double     Fib_Level_6 = 0.764;
extern double     Fib_Level_7 = 1;

string Xtra_txtFib_Level_1  = "Extreme ";
string Xtra_txtFib_Level_2  = "Break OUT ";
string Xtra_txtFib_Level_3  = "Break IN ";
string Xtra_txtFib_Level_4  = "Centre ";
string Xtra_txtFib_Level_5  = "Break IN ";
string Xtra_txtFib_Level_6  = "Break OUT ";
string Xtra_txtFib_Level_7  = "Extreme ";


string txtFib_Level_1  = "";
string txtFib_Level_2  = "";
string txtFib_Level_3  = "";
string txtFib_Level_4  = "";
string txtFib_Level_5  = "";
string txtFib_Level_6  = "";
string txtFib_Level_7  = "";


string FibPrice = " @ %$";
string FibName = "";

int start()
  {

//----
      txtFib_Level_1 = StringConcatenate(Xtra_txtFib_Level_1,DoubleToStr(Fib_Level_1,3),FibPrice);
      txtFib_Level_2 = StringConcatenate(Xtra_txtFib_Level_2,DoubleToStr(Fib_Level_2,3),FibPrice);
      txtFib_Level_3 = StringConcatenate(Xtra_txtFib_Level_3,DoubleToStr(Fib_Level_3,3),FibPrice);
      txtFib_Level_4 = StringConcatenate(Xtra_txtFib_Level_4,DoubleToStr(Fib_Level_4,3),FibPrice);
      txtFib_Level_5 = StringConcatenate(Xtra_txtFib_Level_5,DoubleToStr(Fib_Level_5,3),FibPrice);
      txtFib_Level_6 = StringConcatenate(Xtra_txtFib_Level_6,DoubleToStr(Fib_Level_6,3),FibPrice);
      txtFib_Level_7 = StringConcatenate(Xtra_txtFib_Level_7,DoubleToStr(Fib_Level_7,3),FibPrice);
      
      
      
      FibName = "Brooky_FibR_"+FibOnChartNum;
      ObjectDelete(FibName);
      
      ObjectCreate(FibName,OBJ_FIBO,0,Time[9],High[24],Time[1],Low[1]);
      
      ObjectSet(FibName, OBJPROP_COLOR,Fib_Cbar_Color);
      ObjectSet(FibName, OBJPROP_WIDTH ,Fib_Cbar_Size);
      ObjectSet(FibName, OBJPROP_STYLE ,Fib_Cbar_Style);
      
      ObjectSet(FibName, OBJPROP_RAY,True);
       
      ObjectSet(FibName, OBJPROP_LEVELSTYLE,Fib_Level_Style);
      ObjectSet(FibName, OBJPROP_LEVELCOLOR,Fib_Level_Color);      
      ObjectSet(FibName, OBJPROP_LEVELWIDTH,Fib_Level_Size);  
       
          
      ObjectSet(FibName, OBJPROP_FIBOLEVELS,7);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+0,Fib_Level_1);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+1,Fib_Level_2);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+2,Fib_Level_3);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+3,Fib_Level_4);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+4,Fib_Level_5);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+5,Fib_Level_6);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+6,Fib_Level_7);
      

     
      ObjectSetFiboDescription(FibName,0,txtFib_Level_1);
      ObjectSetFiboDescription(FibName,1,txtFib_Level_2);
      ObjectSetFiboDescription(FibName,2,txtFib_Level_3);
      ObjectSetFiboDescription(FibName,3,txtFib_Level_4);
      ObjectSetFiboDescription(FibName,4,txtFib_Level_5);
      ObjectSetFiboDescription(FibName,5,txtFib_Level_6);
      ObjectSetFiboDescription(FibName,6,txtFib_Level_7);      
      
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments