i-IntradayFibonacci_v2
Download scriptThe i-IntradayFibonacci tool is designed to provide traders with a visual roadmap of price action by automatically plotting key Fibonacci retracement levels based on daily market extremes. Instead of requiring you to manually identify the high and low points of the previous day, this script automates that process to help you identify potential support and resistance zones throughout the current trading day.
How the Logic Works
1. Dynamic Data Scanning The tool scans the historical price data based on a specific number of bars (which you can customize). It looks back through the market history to find the significant boundaries of the preceding trading session.
2. Automated High and Low Detection Every time the calendar moves into a new day, the script automatically detects two critical price points from the daily chart:
- The Highest Price reached during the previous day.
- The Lowest Price reached during the previous day.
3. Precision Fibonacci Calculation Once the high and low of the previous day are identified, the logic calculates four specific "retracement" levels. These are based on standard Fibonacci ratios used by traders to predict where a price might pause or reverse:
- 23.6% Level
- 38.2% Level
- 61.8% Level (The "Golden Ratio")
- 76.4% Level
4. Visual Execution The script then projects these four levels onto your current intraday chart. Because it recognizes when a new day begins, the lines automatically refresh to reflect the new daily highs and lows. This allows you to see at a glance how the current price is reacting relative to yesterday's range, helping you spot potential areas where the market might find "floor" support or "ceiling" resistance.
Key Benefit
By automating these calculations, the tool removes the guesswork of manual drawing. It ensures that your Fibonacci levels are always mathematically consistent with the previous day's price action, allowing for a cleaner and more objective approach to intraday trading.
//+------------------------------------------------------------------+
//| i-IntradayFibonacci.mq4 |
//| Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//| |
//| 14.10.2005 Âíóòðèäíåâíûå óðîâíè Ôèáîíà÷÷è |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link "http://www.kimiv.ru"
//----
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 Lime
#property indicator_color3 Yellow
#property indicator_color4 Salmon
//------- Ãëîáàëüíûå ïåðåìåííûå --------------------------------------
//------- Ïîêëþ÷åíèå âíåøíèõ ìîäóëåé ---------------------------------
//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern int NumberOfBars=1000; // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)
//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double buf24[];
double buf38[];
double buf62[];
double buf76[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init()
{
SetIndexBuffer(0, buf24);
SetIndexStyle (0, DRAW_LINE, STYLE_DOT);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexBuffer(1, buf38);
SetIndexStyle (1, DRAW_LINE, STYLE_DOT);
SetIndexEmptyValue(1, EMPTY_VALUE);
SetIndexBuffer(2, buf62);
SetIndexStyle (2, DRAW_LINE, STYLE_DOT);
SetIndexEmptyValue(2, EMPTY_VALUE);
SetIndexBuffer(3, buf76);
SetIndexStyle (3, DRAW_LINE, STYLE_DOT);
SetIndexEmptyValue(3, EMPTY_VALUE);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start()
{
double dMax, dMin;
int loopbegin, nsb, prevDay, shift;
//----
if (NumberOfBars==0) loopbegin=Bars - 1;
else loopbegin=NumberOfBars - 1;
for(shift=loopbegin; shift>=0; shift--)
{
if (prevDay!=TimeDay(Time[shift]))
{
nsb=iBarShift(NULL, PERIOD_D1, Time[shift]);
dMax=iHigh(NULL, PERIOD_D1, nsb);
dMin=iLow (NULL, PERIOD_D1, nsb);
}
buf24[shift]=dMin-(dMin-dMax)*0.236;
buf38[shift]=dMin-(dMin-dMax)*0.382;
buf62[shift]=dMin-(dMin-dMax)*0.618;
buf76[shift]=dMin-(dMin-dMax)*0.764;
prevDay=TimeDay(Time[shift]);
}
}
//+------------------------------------------------------------------+
Comments