IND Inverse+EMA_v1

Author: Copyright � 2006, ...
IND Inverse+EMA_v1

This custom indicator is designed to provide a visual representation of market momentum and price positioning by calculating a "normalized" value of the current price relative to its recent extremes.

Instead of showing the raw price of an asset, the logic focuses on where the price sits within a specific high-low range. Here is a breakdown of how the system processes this information:

Market Range Analysis

The script begins by scanning a lookback period (determined by your settings) to identify the highest and lowest price points reached during that window. By calculating the difference between these two extremes, the indicator establishes the "amplitude" or the total volatility range of the market for that specific timeframe.

Relative Position Calculation

Once the range is established, the tool calculates where the current closing price sits within that boundary. It determines how far the price has moved from the peak relative to the total size of the range. This result is then multiplied by a scaling factor to create a smoothed numerical value. This effectively converts complex price movements into a standardized scale, making it easier to see if the market is leaning toward the top or bottom of its recent reach.

Smoothing and Trend Identification

To filter out "noise" and minor price flickers, the script applies an Exponential Moving Average (EMA) calculation to these relative values. This produces two distinct visual elements:

  1. The Primary Signal: A line that represents the immediate normalized position of the price.
  2. The Trend Line: A secondary, smoother line that highlights the underlying direction of the market’s momentum.

By observing the relationship between these two lines, users can better identify shifts in market sentiment, potential exhaustion points (where the price hits extreme ends of its range), and overarching trend reversals.

Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
IND Inverse+EMA_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                               IND Inverse.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2006, ..."
#property link      "http://www.forex-tsd.com/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red

//---- input parameters
//---- buffers
double Buffer[];
double EMA[];
extern int iPeriod = 1;
extern int EMAPeriod=25;

//----
//+------------------------------------------------------------------+
//| Init                                                             |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
    string short_name;
    short_name="IND Inverse + EMA("+iPeriod+","+EMAPeriod+")";
    IndicatorShortName(short_name);
    IndicatorDigits(Digits+2);
    SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(0,Buffer);
    SetIndexStyle(1,DRAW_LINE);
    SetIndexBuffer(1,EMA);
//----
    return(0);
}

//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system                                |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();

//---- check for possible errors
   if(counted_bars<0) 
   {
      return(-1);
   }
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- do it
   
  
    for(int i=limit-1; i>=0; i--)
    {
        // Easy to read
        double HD = High[Highest(NULL,0,MODE_HIGH,(iPeriod* 20),i)];
        double LD = Low[Lowest(NULL,0,MODE_LOW,(iPeriod* 20),i)];
        double amplitude = HD - LD;                
        Buffer[i]= ((Close[i]-(HD-(amplitude/2)))/amplitude) * iPeriod;
        EMA[i]=EMA[i+1]+2.0/(1.0+EMAPeriod)*(Buffer[i]-EMA[i+1]); 
    }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments