m-Fibonacci

Download script
Author: ������ ������ aka MikeZTN
m-Fibonacci

This script is a specialized technical analysis tool designed to automate the identification of key price levels on a trading chart. It utilizes mathematical principles—specifically inspired by the Fibonacci sequence—to project potential zones of support and resistance based on historical price action.

Core Functionality

The tool works by analyzing the high, low, and closing prices of specific timeframes (such as daily or hourly charts) to calculate a central "Pivot Point." From this central point, it projects three levels above the market and three levels below it. These levels are calculated using distinct ratios:

  • Primary Pivot: The core average price for a period.
  • Upper Levels (Resistance): Projections that identify potential ceilings where price might struggle to rise further.
  • Lower Levels (Support): Projections that identify potential floors where price might find a base to bounce back up.

Key Features

  • Dynamic Timeframe Compatibility: The script is programmed to work with standard trading intervals (e.g., 30, 60, 240, or 1440 minutes). It includes a built-in check to ensure the user has selected a supported timeframe for accurate calculations.
  • Visual Mapping: The tool automatically draws these calculated levels onto your chart as dotted lines, allowing traders to see the "map" of the market at a glance.
  • Audio Alerts: A unique feature of this script is its notification system. It can be configured to play a specific sound file whenever the current market price enters the vicinity of any of the calculated levels. This serves as an audible signal for traders who may not be constantly staring at the screen, notifying them when the price hits a significant zone.

How it Helps the Trader

Instead of manually guessing where the market might turn, this script provides a systematic way to visualize market structure. By automatically calculating these Fibonacci-based levels, it helps identify "high-interest" areas where large price movements are likely to slow down or reverse, providing a structured framework for making informed trading decisions.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains close prices for each bar
Miscellaneous
It plays sound alerts
12 Views
0 Downloads
0 Favorites
m-Fibonacci
//+------------------------------------------------------------------+
//|                                                  m-Fibonacci.mq4 |
//|                îðèãèíàëüíàÿ èäåÿ äëÿ D1 - Êèì Èãîðü Â. aka KimIV |
//|                                              http://www.kimiv.ru |
//|  Ïåðåïèñàë äëÿ ñòàíäàðòíûõ òàéìôðåéìîâ - Ìèõàèë Æèòíåâ (MikeZTN) |
//|                                                    ICQ 138092006 |
//|                                    2008.09.09   óðîâíè Ôèáîíà÷÷è |
//+------------------------------------------------------------------+
#property copyright "Æèòíåâ Ìèõàèë aka MikeZTN"
#property link      "ICQ 138092006"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 0x00FFFF
#property indicator_color2 0x880088
#property indicator_color3 0xAA00AA
#property indicator_color4 0xDD00DD
#property indicator_color5 0xCCCC00
#property indicator_color6 0xAAAA00
#property indicator_color7 0x777700


//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern int TFBar = 1440;  // Ïåðèîä ïî óìîë÷àíèþ
extern string FileName = "level.wav";
extern int delta=5;
extern bool Notice=true;
datetime LastTime;

//------- Áóôåðû èíäèêàòîðà ------------------------------------------
   double pivot[];
   double r3[];
   double r2[];
   double r1[];
   double s1[];
   double s2[];
   double s3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
  
  bool OK_Period=false;   
  switch (TFBar)
  {    
    case 30:OK_Period=true;break;
    case 60:OK_Period=true;break;
    case 240:OK_Period=true;break;
    case 1440:OK_Period=true;break;
    case 10080:OK_Period=true;break;
    case 43200:OK_Period=true;break;
  }
  if (OK_Period==false)
     {
       Comment("Âû ââåëè íåñòàíäàðòíóþ öèôðó òàéìôðåéìà TFBar! Íåîáõîäèìî ââåñòè îäíó èç ñëåäóþùèõ: 30,60,240,1440 è ò.ä.");   
       return(0);
     }
      
  IndicatorShortName("m-Fibonacci (" +TFBar+")");    
      
  SetIndexBuffer(0, pivot);
  SetIndexStyle (0, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(0, EMPTY_VALUE);

  SetIndexBuffer(1, r3);
  SetIndexStyle (1, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(1, EMPTY_VALUE);

  SetIndexBuffer(2, r2);
  SetIndexStyle (2, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(2, EMPTY_VALUE);

  SetIndexBuffer(3, r1);
  SetIndexStyle (3, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(3, EMPTY_VALUE);

  SetIndexBuffer(4, s1);
  SetIndexStyle (4, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(4, EMPTY_VALUE);

  SetIndexBuffer(5, s2);
  SetIndexStyle (5, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(5, EMPTY_VALUE);

  SetIndexBuffer(6, s3);
  SetIndexStyle (6, DRAW_LINE, STYLE_DOT);
  SetIndexEmptyValue(6, EMPTY_VALUE);
  
  Comment(""); 
}

void Beep(double Level)
  { 
    if (Bid<=Level+delta*Point && Bid>=Level-delta*Point && Notice==true && LastTime!=Time[0])
    {
      PlaySound("level.wav");            
      Print( TimeToStr(Time[0],TIME_SECONDS));
      LastTime = Time[0];        
    }      
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  double dMax, dMin, dClose, R, p;
  int    i, nsb, prevDay, shift;  
 
  for (i=0; i<Bars-1; i++) 
  {
   nsb=iBarShift(NULL, TFBar, Time[i])+1;
   dMax=iHigh(NULL, TFBar, nsb);
   dMin=iLow (NULL, TFBar, nsb);
   dClose =iClose(NULL, TFBar, nsb);
   R = dMax - dMin; //äíåâíîé äèàïàçîí
   p = (dMax + dMin + dClose)/3; // ñòàíäàðòíûé ïèâîò          
   r3[i] = p + (R * 1.000);
   r2[i] = p + (R * 0.618);
   r1[i] = p + (R * 0.382);
   pivot[i] = p; 
   s1[i] = p - (R * 0.382);
   s2[i] = p - (R * 0.618);
   s3[i] = p - (R * 1.000);     
  }
  Beep(r3[0]);
  Beep(r2[0]);
  Beep(r1[0]);
  Beep(pivot[0]);
  Beep(s1[0]);
  Beep(s2[0]);
  Beep(s3[0]);    
   
}
 
//+------------------------------------------------------------------+

Comments