Amplitude_all

Download script
Author: Copyright � 2005, komposter
Amplitude_all

This technical tool is designed to provide a comprehensive visual overview of price movement dynamics by calculating and averaging the different components of price action (candles) across your entire historical chart. Instead of looking at individual price fluctuations, this indicator breaks down "volatility" into specific categories so you can see how much of the market's movement is driven by the actual body of the candle versus the "wicks" or shadows.

The logic operates by analyzing four distinct types of price data:

1. Total Price Range (High-Low) The script calculates the total distance between the highest point and the lowest point reached during each period. By averaging this over time, it gives you a baseline of the overall volatility available in the market.

2. Real Body Movement (Open-Close) It measures the actual "meat" of the candle—the difference between the opening price and the closing price. This represents the true progress made by the market during that period, ignoring the temporary spikes or pullbacks.

3. Upper and Lower Shadows (Wicks) The script intelligently identifies the "shadows" or wicks on both the top and bottom of the candles:

  • Upper Shadow: Measures the distance between the high price and the candle body.
  • Lower Shadow: Measures the distance between the low price and the candle body. Depending on whether the candle closed higher or lower than it opened, the script dynamically identifies which price point belongs to the "body" to ensure the shadow measurement is accurate.

4. Total Shadow Sum Finally, it combines the upper and lower shadows into a single metric. This tells you what percentage of price action was "rejected" (pulled back) versus how much was successfully sustained as a closed body.

How the Data is Processed Rather than showing you a simple snapshot of the current moment, the script performs a cumulative calculation. It traverses your entire trading history, summing up these values and dividing them by the number of bars processed. This creates a running historical average, allowing you to see how these different components of price action have evolved over time relative to each other.

In short, this tool helps you distinguish between "active" price movement (the bodies) and "reactive" price movement (the shadows), providing a deeper look into market sentiment and exhaustion.

10 Views
0 Downloads
0 Favorites
Amplitude_all
//+------------------------------------------------------------------+
//|                                              	Amplitude_All.mq4 |
//|                                      Copyright © 2005, komposter |
//|                                      mailto:komposterius@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, komposter"
#property link      "mailto:komposterius@mail.ru"

#property indicator_separate_window
#property indicator_minimum 0
#property  indicator_buffers 5
#property  indicator_color1  Red
#property  indicator_color2  Lime
#property  indicator_color3  Blue
#property  indicator_color4  Blue
#property  indicator_color5  Blue

double buf0[]; //High-Low Average
double buf1[]; //Body Average
double buf2[]; //Up_Shadow Average
double buf3[]; //Down_Shadow Average
double buf4[]; //Summ_Shadow Average

int init()
{
	IndicatorShortName( "Amplitude (All history average)   -   " );
	IndicatorDigits ( 2 );

	SetIndexBuffer ( 0 , buf0 );
	SetIndexStyle ( 0 , DRAW_LINE );
	SetIndexDrawBegin ( 0 , 0 );
	SetIndexLabel( 0 , "High-Low");

	SetIndexBuffer ( 1 , buf1 );
	SetIndexStyle ( 1 , DRAW_LINE );
	SetIndexDrawBegin ( 1 , 0 );
	SetIndexLabel( 1 , "Open-Close");

	SetIndexBuffer ( 2 , buf2 );
	SetIndexStyle ( 2 , DRAW_LINE, STYLE_DOT );
	SetIndexDrawBegin ( 2 , 0 );
	SetIndexLabel( 2 , "Up_Shadow");

	SetIndexBuffer ( 3 , buf3 );
	SetIndexStyle ( 3 , DRAW_LINE, STYLE_DOT );
	SetIndexDrawBegin ( 3 , 0 );
	SetIndexLabel( 3 , "Down_Shadow");

	SetIndexBuffer ( 4 , buf4 );
	SetIndexStyle ( 4 , DRAW_LINE );
	SetIndexDrawBegin ( 4 , 0 );
	SetIndexLabel( 4 , "Summ_Shadow");

return(0);
}

int start()
{
	int counted_bars=IndicatorCounted();
	if ( counted_bars < 0 ) { Print( "Indicator Error (Counted bars < 0)!" ); return(-1); }
	if ( Bars < 100 ) { Print( "Indicator Error (bars < 100)!" ); return(-1); }
	int limit = Bars - 1;

	double buf_tmp = 0.0, buf_tmp1 = 0.0, buf_tmp2 = 0.0, buf_tmp3 = 0.0, buf_tmp4 = 0.0;
	int bars = Bars, z, z1, z2, z3, z4;
	double high, low, close, open, point = Point;

	for ( int i = limit; i >= 0; i -- )
	{
		high = High[i]; low = Low[i]; close = Close[i]; open = Open[i];

		buf_tmp += ( high - low ) / point;
		buf0[i] = buf_tmp / ( bars - i + z );
		if ( ( high - low ) / point == 0 ) z --;

		buf_tmp1 += MathAbs( ( close - open ) ) / point;
		buf1[i] = buf_tmp1 / ( bars - i + z1 );
		if ( MathAbs( ( close - open ) ) / point  == 0 ) z1 --;

		if ( close - open >= 0 )
		{
			buf_tmp2 += ( high - close ) / point;
			buf2[i] = buf_tmp2 / ( bars - i + z2 );
			if ( ( high - close ) / point  == 0 ) z2 --;

			buf_tmp3 += ( open - low ) / point;
			buf3[i] = buf_tmp3 / ( bars - i + z3 );
			if ( ( open - low ) / point  == 0 ) z3 --;
		}
		else
		{
			buf_tmp2 += ( high - open ) / point;
			buf2[i] = buf_tmp2 / ( bars - i + z2 );
			if ( ( high - open ) / point  == 0 ) z2 --;

			buf_tmp3 += ( close - low ) / point;
			buf3[i] = buf_tmp3 / ( bars - i + z3 );
			if ( ( close - low ) / point  == 0 ) z3 --;
		}
		buf4[i] = buf2[i] + buf3[i];
	}

return(0);
}

Comments