Overview of the MA-Median Indicator
The MA-Median Indicator is a sophisticated technical analysis tool designed to help traders identify smoother, more refined price trends by layering multiple mathematical filters. Instead of relying on a single raw data point, this script processes information through a "multi-stage" smoothing technique to filter out market noise and highlight the underlying momentum of the asset.
How the Logic Works
The indicator operates by calculating three distinct layers of Moving Averages (MA). The core logic follows a sequential flow where each layer builds upon the results of the previous one:
1. The Primary Foundation The process begins by generating an initial Moving Average based on the "Median Price." By using the median price rather than just the closing price, the indicator seeks to provide a more balanced view of the market's value during a specific timeframe. This serves as the raw filtered data for the subsequent steps.
2. The First Smoothing Layer The script then takes that initial foundation and applies a second moving average calculation on top of it. This acts as a "smoothing" agent, reducing sharp fluctuations and jagged movements that can often lead to false signals in volatile trading environments.
3. The Final Refinement Layer In the final step, the script performs a third calculation, applying an additional moving average to the second layer. This creates a highly stabilized trend line. By layering these three computations, the indicator effectively "muffles" short-term price spikes, allowing traders to see the long-term direction of the market more clearly.
Visual Representation and Usage
On your trading chart, this logic is represented by three distinct lines colored in Blue, Green, and Red.
- Trend Identification: Because each line represents a deeper level of smoothing, the relationship between these lines helps traders identify trend strength. When the lines move in unison, it suggests a stable market direction.
- Noise Reduction: The primary goal of this script is to eliminate "market noise." By triple-processing the data, the indicator ensures that the movements you see on the screen are the result of significant price shifts rather than minor, insignificant flickers in the market.
In summary, the MA-Median Indicator transforms raw price action into a refined visual roadmap by passing the data through three successive stages of mathematical smoothing, providing a clearer picture of the market's true momentum.
//+------------------------------------------------------------------+
//| MA-Median.mq4 |
//| ATS TURBO by Andy Ismail |
//| fbsbroker.com |
//+------------------------------------------------------------------+
#property copyright "Andy Ismail"
#property link "http://www.fbsbroker.com/"
#property description "MA Median Indicator by Andy Ismail"
#property strict
//---
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Green
#property indicator_color3 Red
//---- input parameters
extern int maPeriod1=5; //MA Period
//---
int maPeriod_2 = maPeriod1;
int maPeriod_3 = maPeriod1;
int maMethod_1 = 0;
int maAppPrice_1 = 0;
int maMethod_2 = 0;
int maMethod_3 = 0;
//---- indicator buffers
double a[];
double b[];
double c[];
//+------------------------------------------------------------------+
int init()
{
SetIndexDrawBegin(0,maPeriod1+maPeriod_2+maPeriod_3);
SetIndexDrawBegin(1,maPeriod1+maPeriod_2+maPeriod_3);
SetIndexDrawBegin(2,maPeriod1+maPeriod_2+maPeriod_3);
//---
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
//---
SetIndexBuffer(0,a);
SetIndexBuffer(1,b);
SetIndexBuffer(2,c);
//---
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
//---
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int limit,i;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---
for(i=0; i<limit; i++)
{
a[i]=iMA(NULL,0,maPeriod1,0,MODE_EMA,PRICE_MEDIAN,i+1);
}
for(i=0; i<limit; i++)
{
b[i]=iMAOnArray(a,Bars,maPeriod_2,0,MODE_EMA,i+1);
}
for(i=0; i<limit; i++)
{
c[i]=iMAOnArray(b,Bars,maPeriod_3,0,MODE_EMA,i+1);
}
return(0);
}
//+------------------------------------------------------------------+
Comments