Author: Copyright (c) 2009,Kurl FX
MTFPI-sub4

This tool is designed to provide a smoother, more filtered view of price action on your trading charts by utilizing a specific type of visual data known as Heikin-Ashi logic. Unlike standard candlesticks, which represent the exact raw price movements of the market, this script transforms that data into a continuous flow to help traders identify trend direction and momentum more clearly.

How the Logic Works

The core purpose of this script is to calculate two distinct types of "price" points for every candle on your screen:

1. Smoothing the Opening Prices Standard charts show you exactly where a price opened at a specific moment. This tool changes that by calculating the opening point as the average of the previous candle's open and close prices. By doing this, it creates a "connected" look. Instead of the price jumping around erratically from bar to bar, the opening points follow a consistent path, which helps eliminate market "noise" and visual distractions.

2. Redefining the Closing Prices For the closing price of every candle, the script looks at the entire range of movement—specifically the high, low, open, and close prices of that specific period—and calculates their average. This means each candle's closing point represents the "center" of all activity that occurred during that time frame, rather than just where the price happened to end.

The Visual Result

When these two calculations are applied together, the result is a specialized visual representation of the market:

  • Trend Clarity: Because the openings are linked to previous movements and the closings represent averages, the resulting shapes provide a much clearer picture of whether the market is trending upward or downward.
  • Noise Reduction: It filters out the small, insignificant price flickers that often appear on standard charts, making it easier to see the broader "story" of the market's movement.
  • Visual Consistency: By using these calculated averages, the chart presents a more fluid transition between candles, allowing you to see the momentum of the price flow more intuitively.
14 Views
0 Downloads
0 Favorites
MTFPI-sub4
//KurlFX 2009.01.31
//+------------------------------------------------------------------+
//|	*** MTFPI-sub4 ***			HeikinAshi-line							|
//+------------------------------------------------------------------+
#property copyright "Copyright (c) 2009,Kurl FX"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 MediumSeaGreen

double O[];
double C[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------+
int init()
{
	SetIndexBuffer(0,O);
	SetIndexBuffer(1,C);
	SetIndexLabel(0,"HA/h/l");
	SetIndexLabel(1,"HA/l/h");
	return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
	return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
	int counted_bar=IndicatorCounted();
	int limit=Bars-counted_bar;
	if(counted_bar==0) 
	{
		limit-=2;int i=limit;
		O[i]=(Open[i+1]+High[i+1]+Low[i+1]+Close[i+1])/4;
		C[i]=(Open[i]+High[i]+Low[i]+Close[i])/4;
	}
	for(i=limit-1;i>=0;i--)
	{
		O[i]=(O[i+1]+C[i+1])/2;
		C[i]=(Open[i]+High[i]+Low[i]+Close[i])/4; 	 
	}
//----
	return(0);
}
//+------------------------------------------------------------------+

Comments