EYEO_25c6~ZA
Download scriptThis tool is designed to analyze market price movements by identifying key structural levels and smoothed averages. It works by looking at historical price data to determine where the highest and lowest points occur over specific timeframes, then uses those figures to plot visual markers on your chart.
Core Logic Overview
The script operates through three primary stages of calculation to translate raw market noise into readable signals:
1. Identification of Price Extremes The tool first scans the market history to find two specific types of price boundaries:
- Recent Lows: It looks back over a small window of recent bars to identify the lowest price reached.
- Recent Highs: Simultaneously, it looks back over a different window to identify the highest price reached. By identifying these "peaks" and "valleys," the script establishes a baseline for the market's recent range.
2. Multi-Variable Smoothing Once the highs and lows are identified, the script calculates a moving average for four specific data points: Open prices, Close prices, Highs, and Lows. Instead of just looking at a single price point, it aggregates these over a defined period to create a "smoothed" representation of where the market is heading. This helps filter out minor fluctuations and focuses on the broader trend.
3. Dynamic Signal Generation Finally, the script compares the smoothed Opening and Closing prices to determine the visual output:
- It identifies whether the price moved upward or downward during the analyzed period.
- Depending on that movement, it assigns specific values to various buffers which are then displayed on your chart as different colors (Silver, Yellow, Red, and Blue).
- These visual outputs serve as indicators of price action, helping you see the relationship between the current price extremes and the smoothed averages.
Summary for the User
In simple terms, this script acts like a filter. It ignores the "noise" of every single tick by finding the highest and lowest points over recent periods, averaging them out, and then drawing visual signals on your chart to show you where the price is currently positioned relative to those significant boundaries.
/*-----------------------------+
| |
| 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 LowesBuffer[];
double HighesBuffer[];
//+------------------------------------------------------------------+
//| 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);
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;
ind_buffer1[i]=open;
ind_buffer2[i]=close;
ind_buffer3[i]=high;
ind_buffer4[i]=low;
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