DFC Next ج߻Ña¿¼Ñ¡G

Download script
Author: unknown author, get from kaizer, conversed by Rosh
DFC Next ج߻Ña¿¼Ñ¡G

This script is designed as a specialized technical indicator for the MetaTrader platform, primarily used to identify and visualize key price levels based on historical market behavior. Its core logic revolves around identifying significant structural "boundaries" in time and calculating specific price targets using a variation of Fibonacci-style mathematics.

Time Structure Identification

The tool begins by analyzing the timeline of the market. It contains a built-in recognition system that identifies specific "delimiters"—these are key transition points like the start of a new hour, a new day, or specific weekly intervals. By recognizing these milestones, the script can group price action into distinct segments rather than treating every single candle as an isolated event.

Price Range Analysis

Once the script establishes these time boundaries, it looks back over a user-defined number of previous periods (the "Channel Period"). During this look-back:

  • It identifies the Highest High and the Lowest Low reached within that specific timeframe.
  • It calculates an average price point (the "Typical Price") by combining the high, low, and closing prices of the range.

Dynamic Level Calculation

Instead of simply drawing a line at the top or bottom of a range, the script applies a mathematical ratio (defaulted to 0.786). It uses this ratio to project two specific price boundaries relative to the average price:

  1. Upper Boundary: Calculated by moving a proportional distance upward from the average price based on the total height of the high-low range.
  2. Lower Boundary: Calculated by moving a proportional distance downward from the average price.

Visual Output

The final result is a set of dynamic levels that reflect "equilibrium" zones. By using the 0.786 ratio, the indicator highlights areas where the price might face resistance or support based on the historical volatility of previous cycles. This allows traders to see potential "next steps" in price movement by visualizing where the market is likely to react after completing a structural move.

10 Views
0 Downloads
0 Favorites
DFC Next ج߻Ña¿¼Ñ¡G
//+------------------------------------------------------------------------------------+
//|                                                Din_fibo_Next.mq4                   |
//|                                 unknown author, get from kaizer, conversed by Rosh |
//| link to kaizer: http://forum.alpari-idc.ru/profile.php?mode=viewprofile&u=4196161  |
//|                                              http://forexsystems.ru/phpBB/index.php|
//+------------------------------------------------------------------------------------+
#property copyright "unknown author, get from kaizer, conversed by Rosh"
#property link      "http://forexsystems.ru/phpBB/index.php"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Red
//---- input parameters
extern int       Ch_Period=3;
extern double    Ratio=0.786;
extern bool      SetAllBars=false;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double tvBuffer[];
int hh,ll,first,counterPeriod;
double tv,MaH,MaL;
//+------------------------------------------------------------------+
//| Ïðîâåðèì - ðàçäåëèòåëü äèàïàçîíà èëè íåò                         |
//+------------------------------------------------------------------+
bool isDelimeter(int _Period, int _shift)
  {
  bool result=false;
//---- 
  switch (_Period)
   {
   case 5:result=( TimeMinute(Time[_shift])==0) ; break;
   case 15:result=(TimeMinute(Time[_shift])==0); break;
   case 30:result=(TimeMinute(Time[_shift])==0)   && MathMod(TimeHour(Time[_shift]),4.0)==0.0; break;
   case 60:result=(TimeMinute(Time[_shift])==0)&& MathMod(TimeHour(Time[_shift]),4.0)==0.0;break;
   case 240:result=(TimeMinute(Time[_shift])==0) &&(TimeHour(Time[_shift])==0); break;
   case 1440:result=(TimeDayOfWeek(Time[_shift])==1)&&(TimeHour(Time[_shift])==0); break;
   case 10080:result=(TimeDay(Time[_shift])==1)||((TimeDay(Time[_shift])==2 && TimeDay(Time[_shift+1])!=1))||((TimeDay(Time[_shift])==3 && TimeDay(Time[_shift+1])!=2)); break;
   default: Print("Íåäîïóñòèìûé ïåðèîä!!!"); 
   }
//----
   return(result);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
   int    counted_bars=IndicatorCounted();
   int cnt,limit;

//---- 
   if (Period()==10080) return;
   if (counted_bars<0) return(-1);
   if (counted_bars>0) limit=Bars-counted_bars;
   if (counted_bars==0)
      {
      // íàéòè ïåðâûé è âòîðîé ðàçäåëèòåëü è óñòàíîâèòü limit
      cnt=Bars-1;
      while (!isDelimeter(Period(),cnt)) cnt--;
      first=cnt;
      cnt--;
      counterPeriod=0;
      while (counterPeriod<Ch_Period)
         {
         while (!isDelimeter(Period(),cnt)) cnt--;
         cnt--;
         counterPeriod++;
         }
      cnt++;
      hh=Highest(NULL,0,MODE_HIGH,first-cnt,cnt+1);
      ll=Lowest(NULL,0,MODE_LOW,first-cnt,cnt+1);
      tv=NormalizeDouble((High[hh]+Low[ll]+Close[cnt+1])/3.0,Digits);
      MaH=tv+NormalizeDouble((High[hh]-Low[ll])/2.0*Ratio,Digits);
      MaL=tv-NormalizeDouble((High[hh]-Low[ll])/2.0*Ratio,Digits);
      tvBuffer[cnt]=tv;
      ExtMapBuffer1[cnt]=MaH;
      ExtMapBuffer2[cnt]=MaL;
      limit=cnt-1;
      }   
//----
   for (int shift=limit;shift>=0;shift--)
      {
//      if (isDelimeter(Period(),shift)) SetHnL(shift);// else SetMovingHnL(shift);
//      if (shift==0) SetValuesNullBar(shift);
      }
      
   return(0);
  }
  
//+------------------------------------------------------------------+

Comments