ning_heiken_ashi_v1
Download scriptThis technical tool is designed to provide traders with a visual representation of momentum and price movement trends by calculating the "velocity" of specific market averages. Instead of showing you raw price data, it transforms the price history into a visual signal that helps identify how quickly a trend is accelerating or decelerating.
How the Logic Works
The indicator operates through three primary logical steps:
1. Trend Smoothing The script first analyzes the current market price using a Weighted Exponential Moving Average. By using a "Weighted" approach, the logic places more importance on recent price action while still maintaining a smooth curve. This helps filter out the "noise" of minor price fluctuations, allowing you to see the broader direction of the market.
2. Historical Comparison The tool does not look at the price in isolation. It constantly compares the current smoothed average against the previous period's value. By capturing where the average was a moment ago and comparing it to where it is now, the script determines the "distance" traveled by the trend.
3. Momentum Visualization The final output—displayed as a red histogram—represents the difference between these two values.
- When the histogram bars move upward, it indicates that the weighted average is rising at an increasing rate.
- When the bars move downward or shrink, it suggests the trend is losing strength or reversing.
Summary for the Trader
In plain terms, this script acts as a speedometer for the market trend. Rather than just telling you if the price is "up" or "down," it shows you how fast the trend is moving. By observing the height and direction of the red histogram bars, you can better visualize the intensity of market momentum, helping you identify potential shifts in strength before they become obvious in the main price chart.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 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