[i]2MA
Download scriptThis tool is designed to assist traders by providing visual cues on a price chart to identify potential trend reversals based on moving average crossovers. Instead of overwhelming the user with complex data, it simplifies market analysis into clear, actionable visual signals.
How the Logic Works
The script operates by monitoring two different types of "Exponential Moving Averages" (EMAs). These averages represent the trend of the market over different lengths of time. Specifically, it tracks:
- A Fast Average: A shorter-term moving average that reacts more quickly to recent price changes.
- A Slow Average: A longer-term moving average that smooths out market noise to show the broader trend.
Signal Generation
The core logic revolves around the relationship between these two averages on the 4-hour (H4) timeframe. The script looks for specific "crossovers"—moments where the lines cross each other—to trigger visual markers:
- Bullish Signals (Up Arrows): When the Fast Average moves from below the Slow Average to above it, the script identifies this as a potential upward momentum shift. It places an arrow above the price candles to alert you to a possible buying opportunity.
- Bearish Signals (Down Arrows): Conversely, when the Fast Average moves from above the Slow Average to below it, the script identifies this as a potential downward momentum shift. It places an arrow below the price candles to alert you to a possible selling opportunity.
Summary for Traders
By filtering out minor price fluctuations and focusing on these significant crossovers, the indicator helps traders visualize where the trend might be changing direction. It acts as a secondary confirmation tool, highlighting specific points in time where the short-term momentum has officially broken away from the long-term trend.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 5 Min RSI 12-period qual INDICATOR |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link "http://www.lightpatch.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
//---- buffers
double Buffer1[];
double Buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
// 233 up arrow
// 234 down arrow
// 159 big dot
// 158 little dot
// 168 open square
// 120 box with X
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0, Buffer1);
SetIndexArrow(0,233);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1, Buffer2);
SetIndexArrow(1,234);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
for( i=0; i<Bars; i++ ) Buffer1[i]=0;
for( i=0; i<Bars; i++ ) Buffer2[i]=0;
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int pos=Bars-100; // leave room for moving average periods
int ctr=0;
double emaM, emaS;
double PemaM, PemaS;
double p=Point();
while(pos>=1)
{
emaM= iMA(Symbol(),PERIOD_H4, 15,0,PRICE_OPEN,MODE_EMA,pos);
emaS= iMA(Symbol(),PERIOD_H4,100,0,PRICE_OPEN,MODE_EMA,pos);
PemaM=iMA(Symbol(),PERIOD_H4, 15,0,PRICE_OPEN,MODE_EMA,pos+1);
PemaS=iMA(Symbol(),PERIOD_H4,100,0,PRICE_OPEN,MODE_EMA,pos+1);
if (PemaM<emaS && emaM>emaS) {Buffer1[pos]=High[pos]+(50*p);}
if (PemaM>emaS && emaM<emaS) {Buffer2[pos]=Low[pos]-(50*p);}
pos--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments