i-DRProjections_v[1][1].0.1_v2

Download script
Author: ��� ����� �. aka KimIV
i-DRProjections_v[1][1].0.1_v2

This script is a technical analysis tool designed to project potential price movements based on the historical daily range of a financial market. It utilizes logic inspired by Thomas Demark’s trading theories to estimate where the price might travel in the future by analyzing past behaviors.

Core Logic and Functionality

Historical Analysis The tool looks back at a specific number of previous days (which can be customized by the user) to understand the "personality" of the market. For each of these past days, it identifies four key pieces of information:

  • The Opening Price
  • The Highest Price reached
  • The Lowest Price reached
  • The Closing Price

The Calculation Method To determine the projected range, the script evaluates how the price moved relative to where it started each day. It identifies three distinct scenarios for every past day:

  1. If the market closed lower than it opened, it applies a specific weighted average to the high, low, and closing prices.
  2. If the market closed higher than it opened, it uses a different weighted average.
  3. If the market stayed flat (opened and closed at the same price), it uses a third balanced calculation.

This calculation helps establish a "pivot" or a central point of interest based on the day's volatility and direction. From this pivot, the script calculates the distance to the daily high and low points to determine the total range of movement.

Visual Projections The tool then maps these historical ranges onto your chart as lines. This allows you to see how wide or narrow the market has been moving over a set period (e.g., the last 10 days).

Forward-Looking Projection One of the primary features of this script is its ability to "predict" the boundaries for the next trading session. By taking the current day's real-time data (the current price, the daily high, and the daily low), it applies the same weighted logic used in the historical analysis. It then draws two dotted lines extending into the future. These lines represent the projected upper and lower boundaries for the upcoming day based on the patterns established by previous market behavior.

Summary for Traders

Essentially, this script acts as a visual guide. Instead of guessing how far the market might move, it uses the mathematical "footprint" of previous days to draw a boundary of where the price is likely to stay. It helps traders identify potential "ceilings" and "floors" for the next day's trading session based on historical volatility.

Price Data Components
Series array that contains close prices for each bar
10 Views
0 Downloads
0 Favorites
i-DRProjections_v[1][1].0.1_v2
//+------------------------------------------------------------------+
//|                                              i-DRProjections.mq4 |
//|                                           Êèì Èãîðü Â. aka KimIV |
//|                                              http://www.kimiv.ru |
//|   27.08.2005 v.0.0 ïî ïðîñüáå $anto$'à                           |
//| Èíäèêàòîð Daily Range Projections                                |
//| Ïðîãíîçèðîâàíèå äíåâíûõ äèàïàçîíîâ öåí                           |
//| Àâòîð èäåè Òîìàñ Äåìàðê                                          |
//|   29.08.2005 v.0.1 Äîðàáîòêà Aleks78                             |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link      "http://www.kimiv.ru"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Salmon
//------- Âíåøíèå ïàðàìåòðû ------------------------------------------
extern int  NumberOfDay =10;   // Êîëè÷åñòâî äíåé
extern bool ShowTomorrow=True; // Ïîêàçûâàòü çàâòðà
//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double MaxDay[];
double MinDay[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  void init() 
  {
     if (ShowTomorrow) 
     {
      ObjectCreate("LineHi", OBJ_TREND, 0, 0,0, 0,0);
      ObjectCreate("LineLo", OBJ_TREND, 0, 0,0, 0,0);
     }
   SetIndexBuffer(0, MaxDay);
   SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexBuffer(1, MinDay);
   SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, 1);
   Comment("");
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
  void deinit() 
  {
   ObjectDelete("LineHi");
   ObjectDelete("LineLo");
   Comment("");
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
  int start() 
  {
   double po, ph, pl, pc, x;
   double MaxDay1, MinDay1, OpenDay1, CloseDay1; //+++
   int    currDay, i=0, j=0;
     if (Period()>240) 
     {
      Comment("Èíäèêàòîð i-DRProjections íå ïîääåðæèâàåò ÒÔ áîëåå Í4 !");
      return;
     }
     while(i<=NumberOfDay) 
     {
        if (currDay!=TimeDay(Time[j])) 
        {
         po=iOpen (NULL, 1440, i+1);
         ph=iHigh (NULL, 1440, i+1);
         pl=iLow  (NULL, 1440, i+1);
         pc=iClose(NULL, 1440, i+1);
         if (pc<po) x=(ph + pl + pc + pl)/2;
         if (pc>po) x=(ph + pl + pc + ph)/2;
         if (pc==po) x=(ph + pl + pc + pc)/2;
         i++;
        }
      currDay=TimeDay(Time[j]);
      MaxDay[j]=x - pl;
      MinDay[j]=x - ph;
      j++;
     }
//----
     if (ShowTomorrow) 
     {
      MaxDay1  =MarketInfo(Symbol(),MODE_HIGH);
      MinDay1  =MarketInfo(Symbol(),MODE_LOW);
      OpenDay1 =iOpen (NULL, 1440, 0);
      CloseDay1=Bid;
//----
      if (CloseDay1<OpenDay1) x=(MaxDay1 + MinDay1 + CloseDay1 + MinDay1)/2;
      if (CloseDay1>OpenDay1) x=(MaxDay1 + MinDay1 + CloseDay1 + MaxDay1)/2;
      if (CloseDay1==OpenDay1) x=(MaxDay1 + MinDay1 + CloseDay1 + CloseDay1)/2;
//----
      ObjectSet("LineHi",OBJPROP_TIME1, Time[1]);
      ObjectSet("LineLo",OBJPROP_TIME1, Time[1]);
      ObjectSet("LineHi",OBJPROP_PRICE1, x - MinDay1);
      ObjectSet("LineLo",OBJPROP_PRICE1, x - MaxDay1);
      ObjectSet("LineHi",OBJPROP_TIME2, CurTime());
      ObjectSet("LineLo",OBJPROP_TIME2, CurTime());
      ObjectSet("LineHi",OBJPROP_PRICE2, x - MinDay1);
      ObjectSet("LineLo",OBJPROP_PRICE2, x - MaxDay1);
      ObjectSet("LineHi",OBJPROP_COLOR, indicator_color1);
      ObjectSet("LineLo",OBJPROP_COLOR, indicator_color2);
      ObjectSet("LineHi",OBJPROP_RAY, True);
      ObjectSet("LineLo",OBJPROP_RAY, True);
      ObjectSet("LineHi",OBJPROP_STYLE, STYLE_DOT);
      ObjectSet("LineLo",OBJPROP_STYLE, STYLE_DOT);
     }
  }
//+------------------------------------------------------------------+

Comments