i-AMMA_v1
Download scriptThis tool is a visual technical analysis indicator designed to help traders track price trends on their trading charts. Its primary purpose is to smooth out the "noise" of constant market fluctuations, providing a clearer picture of the underlying direction in which a currency or asset is moving.
How it Works
The script operates by calculating a moving average based on a specific number of previous price points (which you can customize). Rather than just showing the raw price, it creates a continuous gold-colored line that flows across your chart.
The Core Logic
- Smoothing Mechanism: Instead of reacting instantly to every minor tick or price jump, the indicator looks at the closing prices of previous candles. It blends these past prices with the current price to create a weighted average.
- Trend Identification: By looking at the "weighted" history, the line acts as a guide. When the price stays consistently above or below this line, it helps identify whether the market is in an uptrend, a downtrend, or moving sideways.
- Dynamic Calculation: The script is designed to update automatically as new candles form. It recalculates its position based on your chosen timeframe and period settings, ensuring that the visual data remains current with real-time market movements.
Key Features for the User
- Customizable Period: You can adjust the "MA_Period" setting to make the line more sensitive or more stable. A shorter period will make the line hug the price action more closely, while a longer period will provide a much smoother, broader view of the long-term trend.
- Visual Clarity: The indicator is rendered as a solid gold line directly on your main chart window, ensuring that it doesn't clutter your workspace while providing high visibility for quick decision-making.
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2012, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "© 2007 RickD"
#property link "www.e2e-fx.net"
#define major 1
#define minor 0
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Gold
extern int MA_Period=25;
double MABuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init()
{
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexDrawBegin(0,MA_Period);
SetIndexBuffer(0,MABuf);
IndicatorShortName("AMMA ("+MA_Period+")");
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit()
{
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start()
{
int counted_bars=IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
if(counted_bars==0) limit-=1+1;
for(int i=limit; i>=0; i--)
{
if(i==Bars-1)
MABuf[i]=Close[i];
else
MABuf[i]=((MA_Period-1)*MABuf[i+1]+Close[i])/MA_Period;
}
}
//+------------------------------------------------------------------+
Comments