Fiboossss
Download scriptThis tool is designed to automatically analyze price movements on your trading chart and provide visual guidance based on Fibonacci retracement levels. It simplifies the process of identifying key support and resistance zones by scanning a specific portion of historical data and plotting relevant geometry instantly.
Core Functionality
The script works by scanning a defined number of recent candles (the "look-back" period) to identify two critical price points: the highest peak and the lowest valley reached during that timeframe. Once these extremes are identified, the tool performs the following actions:
- Dynamic Fibonacci Plotting: It automatically draws a Fibonacci retracement grid between the highest and lowest points found. This helps traders visualize potential "pullback" levels where the price might stall or reverse.
- Trendline Mapping: In addition to the Fibonacci levels, the script draws a trendline connecting the high and low points. Depending on your settings, it can map these trends in different directions (High-to-Low or Low-to-High) to represent either bearish or bullish market structures.
- Visual Anchors: To make the pivot points easy to spot, the script can place vertical lines at the exact moment the highest high and lowest low occurred. This provides a clear "map" of the price action's history.
Key Customizations
Users can tailor the visual output to fit their specific trading style through several settings:
- Directional Logic: You can choose whether the tool identifies the trend from top-to-bottom or bottom-to-top.
- Visual Style: The script allows for customization of colors, line thicknesses, and styles (such as dots or solid lines) to ensure the indicators are clearly visible against your chosen background.
- Timeframe Focus: You can define exactly how many bars back the tool should look, allowing you to focus on short-term "scalping" movements or longer-term structural trends.
Automated Management
The script is designed for a clean workspace. It automatically clears out old drawings and replaces them with updated calculations every time it runs, ensuring that your chart remains clutter-free and only shows the most relevant data based on the current market conditions. When you remove the tool from the chart, it automatically cleans up all its drawings to leave your workspace exactly as you found it.
//+------------------------------------------------------------------+
//| Fibos.mq4 |
//| Developed by Coders' Guru |
//| http://www.xpworx.com |
//+------------------------------------------------------------------+
#property copyright "Coders' Guru"
#property link "http://www.xpworx.com"
string ver = "Last Modified: 2008.02.22 19:20";
#property indicator_chart_window
#property indicator_buffers 7
extern bool Higher_To_Lower = true; //else Lower_To_Higher
extern bool DrawVerticalLines = true;
extern int StartBar = 0;
extern int BarsBack = 20;
extern color FiboColor=Yellow ;
extern int FiboStyle=STYLE_DOT ;
extern int LineStyle=0 ;
extern int LineWidth=1;
extern color LineColor=Red ;
double f_1[];
double f_2[];
void DeleteAllObjects()
{
int objs = ObjectsTotal();
string name;
for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
{
name=ObjectName(cnt);
if (StringFind(name,"V_",0)>-1) ObjectDelete(name);
if (StringFind(name,"H_",0)>-1) ObjectDelete(name);
if (StringFind(name,"f_",0)>-1) ObjectDelete(name);
if (StringFind(name,"fib",0)>-1) ObjectDelete(name);
if (StringFind(name,"trend",0)>-1) ObjectDelete(name);
WindowRedraw();
}
}
void CalcFibo()
{
DeleteAllObjects();
int lowest_bar = iLowest(NULL,0,MODE_LOW,BarsBack,StartBar);
int highest_bar = iHighest(NULL,0,MODE_HIGH,BarsBack,StartBar);
double higher_point = 0;
double lower_point = 0;
higher_point=High[highest_bar];
lower_point=Low[lowest_bar];
if(DrawVerticalLines) DrawVerticalLine("V_UPPER",highest_bar,LineColor);
if(DrawVerticalLines) DrawVerticalLine("V_LOWER",lowest_bar,LineColor);
int i = 0;
if(Higher_To_Lower)
{
for(i = 0; i < 500; i++)
{
f_1[i] = higher_point;
f_2[i] = lower_point;
}
ObjectCreate("fib",OBJ_FIBO,0,0,higher_point,0,lower_point);
ObjectSet("fib",OBJPROP_STYLE,STYLE_DOT);
ObjectSet("fib",OBJPROP_LEVELCOLOR,FiboColor);
ObjectSet("fib",OBJPROP_LEVELSTYLE,FiboStyle);
ObjectCreate("trend",OBJ_TREND,0,Time[highest_bar],higher_point,Time[lowest_bar],lower_point);
ObjectSet("trend",OBJPROP_STYLE,STYLE_DOT);
ObjectSet("trend",OBJPROP_RAY,false);
}
else
{
for(i = 0; i < 500; i++)
{
f_1[i] = higher_point;
f_2[i] = lower_point;
}
DeleteAllObjects();
ObjectCreate("fib",OBJ_FIBO,0,0,higher_point,0,lower_point);
ObjectSet("fib",OBJPROP_STYLE,STYLE_DOT);
ObjectSet("fib",OBJPROP_LEVELCOLOR,FiboColor);
ObjectSet("fib",OBJPROP_LEVELSTYLE,FiboStyle);
ObjectCreate("trend",OBJ_TREND,0,Time[lowest_bar],lower_point,Time[highest_bar],higher_point);
ObjectSet("trend",OBJPROP_STYLE,STYLE_DOT);
ObjectSet("trend",OBJPROP_RAY,false);
}
}
void DrawVerticalLine(string name , int bar , color clr)
{
if(ObjectFind(name)==false)
{
ObjectCreate(name,OBJ_VLINE,0,Time[bar],0);
ObjectSet(name,OBJPROP_COLOR,clr);
ObjectSet(name,OBJPROP_WIDTH,LineWidth);
ObjectSet(name,OBJPROP_STYLE,LineStyle);
WindowRedraw();
}
else
{
ObjectDelete(name);
ObjectCreate(name,OBJ_VLINE,0,Time[bar],0);
ObjectSet(name,OBJPROP_COLOR,clr);
ObjectSet(name,OBJPROP_WIDTH,LineWidth);
ObjectSet(name,OBJPROP_STYLE,LineStyle);
WindowRedraw();
}
}
int deinit()
{
DeleteAllObjects();
return (0);
}
int init()
{
DeleteAllObjects();
SetIndexBuffer(0,f_1);
SetIndexBuffer(1,f_2);
return(0);
}
int start()
{
CalcFibo();
return(0);
}
Comments