Alternative_Ichimoku_v07

Download script
Author: Copyright � 2007, lukas1
Alternative_Ichimoku_v07

This technical tool is an advanced charting indicator designed to analyze market trends and price stability by calculating moving averages based on historical highs and lows. Unlike standard moving averages that might simply average closing prices, this script focuses on the "extremes" of price action over specific timeframes.

Core Logic & Visual Components

The indicator processes data to create several distinct visual layers on your chart:

1. Dynamic Price Channels (The Primary Lines) The script identifies two primary "equilibrium" lines.

  • The Priority Line: This calculates the midpoint between the highest price and the lowest price reached over a specific period (defined by the user). It represents the current "fair value" zone.
  • The Overdue Line: This acts as a secondary comparison, calculating the midpoint of a historical range starting from a different point in time. By comparing these two lines, traders can visualize how current market behavior deviates from past behaviors.

2. The Visual Cloud (Histograms) To make these calculations easier to see at a glance, the script transforms the primary and secondary data into visual histograms. These create a "cloud" or "zone" on the chart, helping users identify where the price is currently sitting relative to its historical equilibrium.

3. Stop-Order & Middle Lines (Optional Support)

  • Stop-Order Line: The script automatically calculates a specific price level based on a wider volatility range. This is designed to help identify potential "breakout" or "reversal" zones where significant price action often occurs.
  • Middle Line: If enabled, this provides a perfectly balanced average of both the current and historical equilibrium lines, offering a third point of reference for neutrality.

Real-Time Market Statistics

Beyond just drawing lines on the chart, the script performs real-time mathematical analysis to provide a text summary directly on your screen. It automatically detects your current timeframe (e.g., minutes, hours, days, or weeks) and calculates the following:

  • Volatility Analysis: It measures the total price range (the distance between the highest high and lowest low) over a set number of bars to show how much the market is moving.
  • Time-Based Ranges: It calculates the specific range covered during your current timeframe (e.g., the high/low of the current day or week).
  • Deviation Tracking: It calculates exactly how far the current price is from the daily/weekly high and low. This allows you to see, in precise units, how much "room" is left before the price hits a major extreme.

Summary for the User

Essentially, this script takes complex historical data—finding the highest and lowest points of the past—and simplifies them into visual lines and a live statistics dashboard. It tells you where the price should be based on history, how volatile the market is right now, and exactly how far the current price has drifted from previous highs and lows.

Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
Alternative_Ichimoku_v07
//+----------------------------------------------------------+
//|                           Alternative_Ichimoku_v07.mq4   |
//|                            Copyright © april 2007 v.07   |
//|                Lukashuk Victor Gennadievich aka lukas1   |
//+----------------------------------------------------------+
#property copyright "Copyright © 2007, lukas1"
#property link ""
//----
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 LightPink
#property indicator_color2 LightSteelBlue
#property indicator_color3 LightPink
#property indicator_color4 LightSteelBlue
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color5 Blue
#property indicator_color6 Magenta
//---- input parameters
// áàðîâ - ðàñ÷¸òíûé ïåðèîä; calculating period
extern int SSP = 75; 
// çàìåäëåíèå âòîðîé ëèíèè;  tolerance of second line
extern int SSK = 75; 
// íå ïîêàçûâàòü ñðåäíþþ ëèíèþ
extern bool Show_Middle = false; 
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double Wal1[];
double Wal2[];
double ExtMapBuffer4[], ExtMapBuffer5[];
int i, j;
double SsMax, SsMin, SsMax05, SsMin05, Rsmin, Rsmax, 
       Tsmin, Tsmax;
double Day_max, Day_min;
int val1, val2, AvgRange, day_bars, day_Range, 
    delta_from_max, delta_from_min, spred;
string comm, sutki;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(8);
//----
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexDrawBegin(0, SSP*2);
// priority line
   SetIndexLabel(0, "îïåðåæàþùàÿ ëèíèÿ"); 
//----
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexDrawBegin(1, SSP*2);
// overdue line
   SetIndexLabel(1, "çàïàçäûâþùàÿ ëèíèÿ"); 
//----
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexBuffer(2, Wal1);
   SetIndexDrawBegin(2,SSP*2);
//----
   SetIndexStyle(3, DRAW_HISTOGRAM);
   SetIndexBuffer(3, Wal2);
   SetIndexDrawBegin(3,SSP*2);
//----
   SetIndexStyle(4, DRAW_LINE);
   SetIndexBuffer(4, ExtMapBuffer4);
   SetIndexDrawBegin(4,SSP*2);
// stop-order line
   SetIndexLabel(4,"ëèíèÿ ñòîï-îðäåðà"); 
//----      
   SetIndexStyle(5, DRAW_LINE);
   SetIndexBuffer(5, ExtMapBuffer5);
   SetIndexDrawBegin(5,SSP*2);
// middle line 
   SetIndexLabel(5,"ñðåäíÿÿ ëèíèÿ");      
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() 
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   comm= ""; 
   int counted_bars = IndicatorCounted();
   if(Bars <= SSP + 1)
       return(0);
   i = Bars - SSP;
   while(i >= 0)
     {
       // RefreshRates();
       // maximum of previous SSP bars period
       SsMax = High[iHighest(NULL, 0, MODE_HIGH, SSP, i)];      
       // minimum of previous SSP bars period
       SsMin = Low[iLowest(NULL, 0, MODE_LOW, SSP, i)];         
       // maximum of SSP bars period for SSK bars from begin
       SsMax05 = High[iHighest(NULL, 0, MODE_HIGH, SSP, i + SSK)];
       // maximum of SSP bars period for SSK bars from begin
       SsMin05 = Low[iLowest(NULL, 0, MODE_LOW, SSP, i + SSK)];   
       ExtMapBuffer1[i] = (SsMax + SsMin) / 2;
       ExtMapBuffer2[i] = (SsMax05 + SsMin05) / 2;
       val1 = ExtMapBuffer1[1] / Point;
       val2 = ExtMapBuffer2[1] / Point;
       // äëÿ âîëàòèëüíîñòè
       Rsmax = High[iHighest(NULL, 0, MODE_HIGH, SSP*2, i)];
       // äëÿ âîëàòèëüíîñòè
       Rsmin = Low[iLowest(NULL, 0, MODE_LOW, SSP*2, i)];
       // ãèñòîãðàììà ðîçîâîãî îáëàêà
       Wal1[i] = ExtMapBuffer1[i]; 
       // ãèñòîãðàììà ãîëóáîãî îáëàêà
       Wal2[i] = ExtMapBuffer2[i]; 
       // ëèíèÿ ñòîï-îðäåðà  
       Tsmax = High[iHighest(NULL, 0,MODE_HIGH, SSP*1.62, i)];   
       // ëèíèÿ ñòîï-îðäåðà
       Tsmin = Low[iLowest(NULL, 0, MODE_LOW, SSP*1.62, i)];       
       ExtMapBuffer4[i] = (Tsmax + Tsmin) / 2;
       //----
       if(Show_Middle)
         {
           ExtMapBuffer5[i] = ((SsMax + SsMin) / 2 + 
                              (SsMax05 + SsMin05) / 2  ) / 2;
         }
       i--;
     }
   day_bars = MathCeil(1440 / Period());
   //if (Period()==1440) day_bars=5;
   sutki = "ñóòêè";
   if(Period() == 1440)  
     {
       sutki = "íåäåëþ";
       day_bars = 5;
     }  // äåíü
   if(Period() == 10080) 
     {
       sutki = "ìåñÿö"; 
       day_bars = 4;
     }  // íåäåëÿ
   if(Period() == 43200) 
     {
       sutki = "ãîä";  
       day_bars = 12;
     }  // ìåñÿö
   j = SSP*2 + 1;
   while(j >= 0)
     { 
       // îïðåäåëÿåì äíåâíîé äèàïàçîí
       // ëèíèÿ ìàêñ äíÿ  
       Day_max = High[iHighest(NULL, 0,MODE_HIGH, day_bars, j + 1)];   
       // ëèíèÿ ìèí. äíÿ
       Day_min = Low[iLowest(NULL, 0, MODE_LOW, day_bars, j + 1)];           
       j--;
     }      
   AvgRange = (Rsmax / Point) - (Rsmin / Point);
   day_Range = (Day_max / Point) - (Day_min / Point); 
   delta_from_max = (Day_max-Bid) / Point;
   delta_from_min = (Bid - Day_min) / Point;
//----
   comm = " ïàðàìåòðû  SSP , SSK  =   " + SSP + " ,  " + SSK + " ;\n" +
          " âîëàòèëüíîñòü  (çà " + SSP*2 + " áàðîâ) :      " + 
          AvgRange + "  ï.\n" + "\n" +
          " äèàïàçîí çà " + sutki + "  (çà  " + day_bars + 
          "  áàðîâ) :   " + day_Range + "  ï.\n" +
          " îòêëîíåíèå îò ìàêñèìóìà çà " + sutki + ":  " + 
          delta_from_max + "  ï.\n" +
          " îòêëîíåíèå îò ìèíèìóìà  çà " + sutki + ":  " + 
          delta_from_min + "  ï.\n";            
   Comment(comm);
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments