Average_Change

Download script
Author: Copyright � 2009, MT-Coder.
Average_Change

This custom indicator, titled "Average Change," is designed to provide visual feedback on the relationship between current market prices and a specific moving average. Rather than showing standard price action, it transforms the data into a specialized ratio to help traders identify significant shifts or deviations in the market's momentum.

How the Logic Works

The tool operates by processing historical price data through three distinct logical stages:

1. Establishing a Baseline (The Reference Point) The indicator first looks at a specific timeframe defined by the user (the "ACPeriod"). It calculates a Linear Weighted Moving Average (LWMA) based on the median prices of the candles within that period. By using a linear weighted average, the tool places more importance on the most recent price data, ensuring that the baseline stays relevant to current market conditions.

2. Calculating the Ratio Once the baseline is established, the script compares the "Open" price of the current candle against that calculated moving average. It doesn't just look at the difference between the two; instead, it performs a mathematical calculation where both the Open price and the Moving Average are raised to the fifth power.

3. Visualizing the Result The final value plotted on your chart is the result of dividing those two powered numbers. By raising the values to the fifth power before dividing them, the indicator significantly amplifies the differences between the price and its average. This mathematical "stretch" makes it much easier for a trader to see even subtle accelerations or changes in price direction that might be hard to spot on a standard candle chart.

What this means for your trading

The resulting line on your screen represents the relative strength of the current price compared to its recent history. When the line moves significantly, it suggests that the market is deviating from its "average" behavior at an accelerating rate. This tool is intended to help you identify these moments of momentum change to find potential entry or exit signals based on how aggressively the price is moving away from its mean.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Average_Change
//+------------------------------------------------------------------+
//|                 This has been coded by MT-Coder                  |
//|                                                                  |
//|                     Email: mt-coder@hotmail.com                  |
//|                      Website: mt-coder.110mb.com                 |
//|                                                                  |
//| For a price I can code for you any strategy you have in mind     |
//|           into EA, I can code any indicator you have in mind     |
//|                                                                  |
//|          Don't hesitate to contact me at mt-coder@hotmail.com    |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|        This is the basic version of the Average Change indicator |
//|          This indicator reflects the effect of the latest        |
//|               price changes.                                     |
//|           Try to get some trading signals out of that! Enjoy!    |
//+------------------------------------------------------------------+



#property copyright "Copyright © 2009, MT-Coder."
#property link      "http://mt-coder.110mb.com/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 White

//---- input parameters
extern int ACPeriod=15;
//---- buffers
double MainBuffer[];
double TempBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
   //---- 1 additional buffer used for counting.
   IndicatorBuffers(2);
   IndicatorDigits(Digits);
//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MainBuffer);
   SetIndexBuffer(1,TempBuffer);
  
   
//---- name for DataWindow and indicator subwindow label
   short_name="Average Change("+ACPeriod+") - by mt-coder@hotmail.com";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Average Change");
  
//----
   SetIndexDrawBegin(0,ACPeriod);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Four legs                                                        |
//+------------------------------------------------------------------+
int start()
  {
   int i,counted_bars=IndicatorCounted();
//----
   if(Bars<=ACPeriod) return(0);

//----
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;
   for(i=0; i<limit; i++)
      TempBuffer[i]=iMA(NULL,0,ACPeriod,0,MODE_LWMA,PRICE_MEDIAN,i);
//----
   i=Bars-ACPeriod-1;
   if(counted_bars>=ACPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {

      
      MainBuffer[i]=MathPow(Open[i],5)/MathPow(TempBuffer[i],5);
      
      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments