Author: Copyright ?2004, MetaQuotes Software Corp.
mikahekin

The mikahekin indicator is a technical analysis tool designed to provide traders with a multi-layered view of price action by synthesizing various market elements into visual signals. It operates by analyzing historical price data over specific moving windows to identify trends, extremes, and price movements.

Core Analytical Logic

The script processes market data through three distinct calculation layers:

1. Extreme Price Identification (Highs and Lows) The tool first establishes the "boundaries" of recent price action. It scans the chart to identify the highest points and lowest points reached over two different specific timeframes (defined by the K and D periods). By isolating these extremes, the logic creates a framework of the market's volatility limits rather than just looking at the current price.

2. Multi-Variable Averaging Once the extremes are established, the indicator performs a comprehensive calculation across a larger timeframe (the J period). It calculates the moving averages for four key components:

  • Open Prices: The starting value of each candle.
  • Close Prices: The finishing value of each candle.
  • Highs: Derived from the previously calculated extreme high points.
  • Lows: Derived from the previously calculated extreme low points.

By averaging these four values, the indicator smooths out "market noise," providing a clearer picture of the underlying price trend.

3. Visual Signal Generation The final step of the logic translates these calculations into visual elements on your chart:

  • Trend Boundaries: It plots specific high and low lines (represented as arrows) to show where the averaged extremes currently sit.
  • Price Action Dynamics: The script compares the opening and closing prices of each candle. Based on whether the price moved up or down during that period, it identifies and highlights specific price levels (Open vs. Close) using a histogram format.

Summary for the Trader

In essence, this indicator does not just show you where the price is; it shows you where the price should be relative to its recent history. By blending current candle behavior with smoothed averages of historical highs and lows, it aims to help users distinguish between temporary price fluctuations and significant structural movements in the market.

Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
mikahekin
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                    mikahekin.mq4 |
//|                       Copyright ?2004, MetaQuotes Software Corp. |
//|                                                http://www.sasara |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Silver
#property  indicator_color2  Yellow
#property  indicator_color3  Red
#property  indicator_color4  Blue
//---- input parameters
extern int KPeriod=3;
extern int DPeriod=3;
extern int JPeriod=7;

double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
double HighesBuffer[];
double LowesBuffer[];

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 3);
   SetIndexBuffer(0, ind_buffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0, 3);
   SetIndexBuffer(1, ind_buffer2);
   SetIndexStyle(2,DRAW_ARROW, 0, 1);
   SetIndexBuffer(2, ind_buffer3);
   SetIndexStyle(3,DRAW_ARROW, 0, 1);
   SetIndexBuffer(3, ind_buffer4);
//----
   SetIndexDrawBegin(0,10);
   SetIndexDrawBegin(1,10);
   SetIndexDrawBegin(2,10);
   SetIndexDrawBegin(3,10);
//---- indicator buffers mapping
   SetIndexBuffer(0,ind_buffer1);
   SetIndexBuffer(1,ind_buffer2);
   SetIndexBuffer(2,ind_buffer3);
   SetIndexBuffer(3,ind_buffer4);
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("mikahekin");
   SetIndexLabel(0,"Open");
   SetIndexLabel(1,"Close");
   SetIndexLabel(2,"High");
   SetIndexLabel(3,"Low");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k,j;
   int    counted_bars=IndicatorCounted();
   double price,price1;
   
//----
   if(Bars<=10) return(0);
//---- initial zero
   if(counted_bars<0)
   return (-1);
//---- minimums  counting
   i=Bars-KPeriod;
   if(counted_bars>KPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double min=1000000;
      k=i+KPeriod-1;
      while(k>=i)
        {
         price=Low[k];
         if(min>price) min=price;
         k--;
        }
      LowesBuffer[i]=min;
      i--;
     }
//---- maximums counting
   i=Bars-DPeriod;
   if(counted_bars>DPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double max=-100000;
      j=i+DPeriod-1;
      while(j>=i)
        {
         price=High[j];
         if(price1>max) max=price1;
         j--;
        }
      HighesBuffer[i]=max;
      i--;
     }
//---- mikahekin calcaulation
   i=Bars-JPeriod;
   if(counted_bars>JPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double sumlow=0.0;
      double sumhigh=0.0;
      double sumopen=0.0;
      double sumclose=0.0;
      double close=0.0;
      double open=0.0;
      double high=0.0;
      double low=0.0;

      for(k=(i+JPeriod-1);k>=i;k--)
        {
          sumclose+=Close[k];
          close=sumclose/JPeriod;
          sumlow+= LowesBuffer[k];
          low= sumlow/JPeriod;
          sumhigh+=HighesBuffer[k];
          high=sumhigh/JPeriod;
          sumopen+=Open[k];
          open=sumopen/JPeriod;
        }

      ind_buffer3[i]=high;
      ind_buffer4[i]=low;

      if(open>close) ind_buffer1[i]=open;
      else ind_buffer1[i]=close;
      
      if(open<close) ind_buffer2[i]=open;
      else ind_buffer2[i]=close;
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+


Comments