multima
Download scriptThis tool is designed as a visual aid for traders to analyze price trends by plotting three distinct moving averages directly on a trading chart. By smoothing out market "noise," it helps users identify the underlying momentum of an asset more clearly.
Core Functionality
The script calculates and displays three separate lines on your screen, each representing a different timeframe of market movement. Each line is governed by its own specific settings, allowing you to customize how they behave based on your trading style:
- Variable Timeframes: The tool tracks three different periods simultaneously (set at 1, 5, and 15 units respectively). This allows you to see immediate, short-term fluctuations alongside broader, longer-term trends.
- Customizable Smoothing Methods: You can choose how the averages are calculated. The script supports four different mathematical methods: Simple (SMA), Exponential (EMA), Smoothed (SMMA), and Linear Weighted (LWMA). This flexibility ensures that the lines react to price changes at a speed that suits your specific strategy.
- Visual Identification: Each of the three moving averages is assigned a unique color (Red, Blue, and Yellow) to make it easy to distinguish between the different timeframes at a glance.
How it Works for the User
When you apply this script to a chart, it automatically scans the historical price data and calculates the average price for the periods you have defined. As new price data comes in, the lines update in real-time.
Because it displays three different layers of averages at once, it allows you to observe "confluences"—points where short-term momentum aligns with long-term trends. For example, a trader can use these lines to see if a quick price spike is backed by the broader trend or if it is an isolated move that might be likely to reverse.
Summary of Customization
Users have full control over the "sensitivity" of each line. By adjusting the period and the calculation method in the settings, you can transform the indicator from a highly reactive tool that follows every minor price tick into a smoother, more stable guide that highlights only the most significant market shifts.
//--------------------------------------------------------------------
// multima.mq4
//| Copyright © 2008, Viennatrader |
//| |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
extern string c0="Use for Methode:";
extern string c1="MODE_SMA: 0";
extern string c2="MODE_EMA: 1";
extern string c3="MODE_SMMA: 2";
extern string c4="MODE_LWMA: 3";
extern int ma1=5;
extern int ma1_periode=1;
extern int ma1_methode=1;
extern int ma2=5;
extern int ma2_periode=5;
extern int ma2_methode=1;
extern int ma3=5;
extern int ma3_periode=15;
extern int ma3_methode=1;
double Buf_0[];
double Buf_1[];
double Buf_2[];
//--------------------------------------------------------------------
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,Buf_0);
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buf_1);
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(2,Buf_2);
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
return;
}
//--------------------------------------------------------------------
int start()
{
int i,
n,
Counted_bars;
double
Sum_H,
Sum_L;
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted();
i=Bars-Counted_bars-1;
while(i>=0)
{
Buf_0[i]=iMA(Symbol(),ma1_periode,ma1,0,ma2_methode,0,i);
Buf_1[i]=iMA(Symbol(),ma2_periode,ma2,0,ma2_methode,0,i);
Buf_2[i]=iMA(Symbol(),ma3_periode,ma3,0,ma2_methode,0,i);
i--;
}
//--------------------------------------------------------------------
return;
}
//--------------------------------------------------------------------
Comments