ning_heiken_ashi
Download scriptThis tool is designed as a visual trading indicator for the MetaTrader platform, specifically created to help traders identify momentum and price fluctuations. It operates independently of the main price chart, appearing in a separate window to provide a cleaner perspective on market movements.
Core Methodology
The logic behind this script revolves around calculating the "velocity" or change in a specific type of moving average. Instead of just showing the average price itself, this indicator focuses on the difference between current values and previous values to highlight trends more clearly.
How it Works
- Data Processing: The tool looks at the weighted average price of the assets over a short period (3 periods). It uses an "Exponential" calculation method, which gives more importance to the most recent price data, making it more responsive to sudden market shifts.
- Momentum Tracking: The script captures the current moving average value and compares it against the value from the preceding moment.
- Visual Output: By subtracting the previous value from the current one, the tool generates a "signal." This signal is displayed as a red histogram.
Practical Application
Because the indicator tracks the change between two points in time:
- Expanding Bars: When the histogram grows, it indicates that the moving average is accelerating in a specific direction (upward or downward).
- Shrinking Bars: When the bars get smaller, it suggests that the momentum is slowing down, even if the price is still moving.
- Zero Line Interaction: The indicator fluctuates around a zero level. This helps traders visualize whether the current price movement is gaining strength or losing steam compared to where it was just a moment before.
In summary, this script serves as a momentum gauge. It filters out minor market noise to show you the "heartbeat" of the price action, helping you see not just where the price is going, but how fast it is moving to get there.
//+------------------------------------------------------------------+
//| copyright:Ma ning
// e-mail: maningok@163.com
// msn:man2078@msn.com
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_level1 0
//---- buffers
double ha,ha1;
double signal[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
SetIndexBuffer(0, signal);
SetIndexEmptyValue(0,0.0);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
for (int i=Bars-1;i>=0;i--)
{
ha1=ha; ha=iMA(NULL,0,3,0,MODE_EMA,PRICE_WEIGHTED,i);
signal[i]=ha-ha1;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments