0_IndInverse_v1

Download script
Author: Copyright � 2006, ...
0_IndInverse_v1

This custom indicator is designed to analyze price movements by calculating the relative position of the current market price within a specific historical range. It aims to identify trend reversals and momentum shifts by visually representing these dynamics in a separate window on your trading platform.

Core Logic and Mechanism

1. Range Analysis (Amplitude) The tool begins by scanning a specific number of previous bars (determined by the user-defined period) to identify the highest high and the lowest low reached during that time. By measuring the distance between these two extremes, the script establishes the "amplitude" or the total territory of the current price movement.

2. Normalized Positioning (The Buffer) Once the range is established, the script calculates where the current closing price sits in relation to that high and low. It treats the space between the highs and lows as a coordinate system. This allows the tool to determine if the price is currently hugging the top of its recent range, sitting in the middle, or dropping toward the bottom.

3. Trend Detection and Signal Generation The heart of the indicator lies in how it tracks changes between these positions from one bar to the next:

  • Crossover Identification: The script looks for moments when the calculated value flips from positive to negative (or vice versa). This suggests a significant shift in momentum, indicating that the price has moved from one end of its relative range to the other.
  • Visual Indicators:
    • When a shift is detected, the tool places visual markers (arrows) on the chart.
    • These markers distinguish between types of movement: one set of arrows highlights upward momentum signals, while another set identifies downward reversals.

Summary for Traders

Essentially, this script acts as a "momentum thermometer." Instead of just looking at whether the price is going up or down, it measures how far the price has moved relative to its recent boundaries. When the price moves from being "high" in its range to "low" (or vice versa) rapidly enough to flip the mathematical sign of the calculation, the script triggers an arrow to alert you to a potential reversal in the market trend.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
0_IndInverse_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 3
#property indicator_color1 Maroon
#property indicator_color2 Green
#property indicator_color3 Red

//---- input parameters
//---- buffers
double Buffer[];
double SigBuffer[];
double DirBuffer[];

extern int iPeriod = 1;
extern int cbars = 1000;

//----
//+------------------------------------------------------------------+
//| Init                                                             |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
    IndicatorDigits(Digits+2);
    SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(0,Buffer);
    
    
    SetIndexStyle(1,DRAW_ARROW);
    SetIndexBuffer(1,SigBuffer);
    SetIndexEmptyValue(1,0);
    SetIndexArrow(1,233);
    
    SetIndexStyle(2,DRAW_ARROW);
    SetIndexBuffer(2,DirBuffer);
    SetIndexEmptyValue(2,0);
    SetIndexArrow(2,234);

//----
    return(0);
}

int last = 0;
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system                                |
//+------------------------------------------------------------------+
int start()
  {
   if(last == 0) ArrayInitialize(DirBuffer,0);
   last = Bars;
   
    int b = 0,i = 0;
    for(i=0; i<=cbars; 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;
        if(amplitude!=0)
            Buffer[i]= ((Close[i]-(HD-(amplitude/2)))/amplitude) * iPeriod;
        else
            Buffer[i]= Close[i] * iPeriod;
        }
    double dir = 0;
    for(i=cbars; i>=0; i--){
        SigBuffer[i] = 0;
        DirBuffer[i] = 0;
        if(Buffer[i]*Buffer[i+1]<0){
            if(Buffer[i]<0) DirBuffer[i] = Buffer[i];
            else SigBuffer[i] = Buffer[i];
            }
        }
       
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments