This tool is designed as a visual chart indicator that processes historical price data to identify specific market trends and averages. Rather than just showing raw price movements, it analyzes the relationship between four key data points—Open, High, Low, and Close prices—over set periods of time to provide a smoothed representation of market activity.
Core Logic and Data Processing
The script operates by breaking down the market's behavior into three distinct layers of analysis:
- Low-Point Identification: The tool scans recent price history to identify the lowest points reached during a specific timeframe. It focuses on finding the "bottom" of these movements to establish a baseline for support or floor levels.
- High-Point Identification: Simultaneously, the script looks back over a different period to pinpoint the highest peaks reached. This helps in establishing a ceiling or resistance level based on previous price action.
- Averaged Smoothing: Once the highs and lows are identified, the tool calculates the averages for all four primary price types (Open, High, Low, and Close) across a secondary timeframe.
Visual Output
The final result of these calculations is plotted directly on your trading chart. Instead of showing every erratic tick of the market, the indicator produces:
- Four Distinct Data Streams: It creates visual representations for the averaged Open, High, Low, and Close prices.
- Trend Visualization: By using different colors and widths (such as Silver, Yellow, Red, and Blue), it allows you to see the "heart" of the price action.
- Market Context: Because these values are smoothed averages based on both extreme points (the highs/lows) and standard prices (opens/closes), the visual output helps traders distinguish between temporary market noise and actual sustained momentum.
In essence, this script acts as a filter that strips away the "jitter" of live trading to show you the underlying structure of price movement based on historical averages.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| mikahekin.mq4 |
//| Copyright 2004, MetaQuotes Software Corp. |
//| http://www.sasara |
//| Modified by: Ronald Verwer/ROVERCOM |
//+------------------------------------------------------------------+
#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
#property indicator_width1 3
#property indicator_width2 3
//---- 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;
IndicatorBuffers(6);
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 3);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 3);
SetIndexStyle(2,DRAW_ARROW, 0, 1);
SetIndexStyle(3,DRAW_ARROW, 0, 1);
//----
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
SetIndexDrawBegin(4,10);
SetIndexDrawBegin(5,10);
//---- indicator buffers mapping
SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer3);
SetIndexBuffer(3,ind_buffer4);
SetIndexBuffer(4, HighesBuffer);
SetIndexBuffer(5, LowesBuffer);
//---- 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;
//----
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(price>max) max=price;
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;
sumopen+=Open[k];
open=sumopen/JPeriod;
sumhigh+=HighesBuffer[k];
high=sumhigh/JPeriod;
}
ind_buffer1[i]=open;
ind_buffer2[i]=close;
ind_buffer3[i]=high;
ind_buffer4[i]=low;
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments