This tool is designed as a comprehensive technical analysis indicator for the MetaTrader platform. Its primary purpose is to filter market noise and identify potential trading opportunities by synthesizing data from several different technical metrics simultaneously. Instead of relying on a single signal, it looks for "confluence"—the point where multiple different types of market behavior agree with each other.
How the Logic Works
The script constantly scans the price action of a financial asset and evaluates six distinct categories of technical data:
1. Trend Identification (Moving Averages) The script monitors two different Moving Averages (a "Fast" and a "Slow" average). It specifically looks for "crossovers." If the Fast average crosses above the Slow average, it suggests upward momentum; if it crosses below, it suggests downward momentum. The logic is designed to ensure these shifts are confirmed by looking at the price points immediately before and after the current moment.
2. Momentum and Strength (RSI, MACD, and ADX) To ensure a move has actual "teeth" behind it, the script checks three other factors:
- Relative Strength Index (RSI): It looks to see if the price is in a strong position relative to its recent history.
- MACD: It compares a standard trend oscillator against a signal line to confirm that the current movement is accelerating in the desired direction.
- ADX (Average Directional Index): It uses the Plus and Minus directional indices to determine which way the "flow" of the market is leaning.
3. Volatility and Pressure (Momentum, DeMarker, and Force Index) The tool further validates the market's health by checking:
- Momentum: Whether the price is moving faster than a specific baseline.
- DeMarker & Force Index: These are used to gauge the underlying "pressure" of the market, helping to distinguish between a genuine trend and a weak, exhausted move.
Visual Output and Alerts
The script translates these complex calculations into clear visual signals on your chart:
- Trend Signals: It identifies broad "Up" and "Down" zones based on momentum and force.
- Cross Signals: It highlights specific points where the RSI, MACD, and ADX all align to suggest a reversal or breakout.
- MA Crossovers: It provides distinct markers for the exact moment the Moving Averages cross.
User Experience Features
- Customizable Parameters: Users can adjust the "speed" of the averages and the sensitivity of various oscillators (like RSI and MACD) to fit different trading styles (e.g., scalping vs. long-term swing trading).
- Audio Notifications: The script includes an optional alert system that can trigger a sound notification when a Moving Average crossover occurs, allowing traders to react instantly without staring at the screen constantly.
In summary, this is a "multi-factor" filter. It ensures that a trade signal is only highlighted when several independent mathematical models agree that the market is moving in a specific direction.
//+------------------------------------------------------------------+
//| GoldenFilter_v1.mq4 |
//| Copyright © 2007, madro |
//| madrofx@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, madro"
#property link "madrofx@yahoo.com"
//----
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_color1 LightSkyBlue
#property indicator_color2 OrangeRed
#property indicator_color3 Gold
#property indicator_color4 Red
#property indicator_color5 Gold
#property indicator_color6 Red
#property indicator_color7 Gold
#property indicator_color8 Red
#property indicator_width7 2
#property indicator_width8 2
//----
extern int FasterMA = 5;
extern int SlowerMA = 15;
extern int MA1_Type = 1;
extern int MA2_Type = 1;
extern int MACD_Fast = 8;
extern int MACD_Slow = 17;
extern int MACD_Signal = 9;
extern int RSI = 21;
extern int Momentum = 14;
extern int DeMarker = 14;
extern int ADX = 14;
extern int ForceIndex = 14;
extern bool SoundAlert = false;
//---- indicator buffers
double Up[];
double Down[];
double CrossUp[];
double CrossDown[];
double TrendUp[];
double TrendDown[];
double MAUp[];
double MADown[];
double alertBar;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0,120);
SetIndexBuffer(0, Up);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1,120);
SetIndexBuffer(1, Down);
SetIndexStyle(2, DRAW_ARROW);
SetIndexArrow(2, 251);
SetIndexBuffer(2, CrossUp);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(3, 251);
SetIndexBuffer(3, CrossDown);
SetIndexStyle(4, DRAW_ARROW);
SetIndexArrow(4, 110);
SetIndexBuffer(4, TrendUp);
SetIndexStyle(5, DRAW_ARROW);
SetIndexArrow(5, 110);
SetIndexBuffer(5, TrendDown);
SetIndexStyle(6, DRAW_ARROW);
SetIndexArrow(6, 241);
SetIndexBuffer(6, MAUp);
SetIndexStyle(7, DRAW_ARROW);
SetIndexArrow(7, 242);
SetIndexBuffer(7, MADown);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("madro-9");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| GoldenFilter_v1 |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int i;
int limit;
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
double fasterMAnow = iMA(NULL, 0, FasterMA, 0, MA1_Type,
PRICE_CLOSE, i);
double fasterMAprevious = iMA(NULL, 0, FasterMA, 0, MA1_Type,
PRICE_CLOSE, i + 1);
double fasterMAafter = iMA(NULL, 0, FasterMA, 0, MA1_Type,
PRICE_CLOSE, i - 1);
double slowerMAnow = iMA(NULL, 0, SlowerMA, 0, MA2_Type,
PRICE_CLOSE, i);
double slowerMAprevious = iMA(NULL, 0, SlowerMA, 0,
MA2_Type, PRICE_CLOSE, i + 1);
double slowerMAafter = iMA(NULL, 0, SlowerMA, 0, MA2_Type,
PRICE_CLOSE, i - 1);
//----
double MACD = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow,
MACD_Signal, PRICE_CLOSE, MODE_MAIN, i);
double MACD_Sig = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow,
MACD_Signal, PRICE_CLOSE, MODE_SIGNAL, i);
//----
double ADX1 = iADX(NULL, 0, ADX, PRICE_CLOSE, MODE_PLUSDI, i);
double ADX2 = iADX(NULL, 0, ADX, PRICE_CLOSE, MODE_MINUSDI, i);
//----
double RSIV = iRSI(NULL, 0, RSI, 0, i);
double DEM = iDeMarker(NULL, 0, DeMarker, i);
double MOM = iMomentum( NULL,0, Momentum, PRICE_CLOSE, i);
double FI = iForce(NULL, 0, ForceIndex, 1, PRICE_CLOSE, i);
if(MOM > 100)
Up[i] = 0.05;
if(MOM <= 100)
Down[i] = 0.05;
if(DEM > 0.5 && FI >0)
TrendUp[i] = 0.22;
if(DEM < 0.5 < 50 && FI < 0)
TrendDown[i] = 0.22;
if(RSIV > 50 && MACD > MACD_Sig && ADX1 > ADX2)
CrossUp[i] = 0.47;
if(RSIV < 50 && MACD < MACD_Sig && ADX1 < ADX2)
CrossDown[i] = 0.47;
if((fasterMAnow > slowerMAnow) &&
(fasterMAprevious < slowerMAprevious) &&
(fasterMAafter > slowerMAafter))
{
MAUp[i] = 0.8;
if(SoundAlert == true && Bars>alertBar)
{
Alert("GoldenMadro Up " + Symbol() + " on the " +
Period() + " minute chart.");alertBar = Bars;
}
}
if((fasterMAnow < (slowerMAnow)) &&
(fasterMAprevious > (slowerMAprevious)) &&
(fasterMAafter < slowerMAafter))
{
MADown[i] = 0.8;
if(SoundAlert == true && Bars>alertBar)
Alert("GoldenMadro Up " + Symbol() + " on the " +
Period() + " minute chart.");alertBar = Bars;
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments