I_XO_A_H_v1
Download scriptThis technical indicator is designed to analyze price movements on a trading chart by identifying significant shifts in market direction based on a predefined price threshold. Instead of looking at every minor fluctuation, the script focuses on substantial "breaks" in price action to help traders visualize trend momentum.
Core Logic and Functionality
The tool operates by monitoring the closing price of candles to determine if the market is making significant upward or downward progress. It uses a specific "Box Size" (a user-adjustable sensitivity parameter) to decide whether a price move is large enough to be considered a meaningful trend change.
How the tracking works:
- Upward Momentum Tracking: The script looks for instances where the current price climbs significantly higher than the previous high recorded. When the price exceeds this established boundary by the designated "Box Size," the indicator registers an upward move.
- Downward Momentum Tracking: Conversely, it monitors for instances where the price drops significantly below the previous low. If the price breaks downward past the "Box Size" threshold, it registers a downward move.
- Trend Counting: The logic maintains a running tally of these significant movements. Every time a new upward break occurs, it increments a counter for positive momentum. When a downward break occurs, it identifies and tracks negative momentum.
Visual Representation
The indicator displays its findings in a separate window below the main trading chart using two distinct visual elements:
- Positive Momentum (Green): This represents the accumulation of upward price breaks. As more significant upward moves occur, the green histogram reflects this increasing trend strength.
- Negative Momentum (Red): This represents the accumulation of downward price breaks. The red histogram highlights the intensity of the downward movement.
Summary for Traders
In essence, this script filters out "market noise" and only reacts when the price makes a meaningful leap in either direction. By observing the height and frequency of the green and red histograms, traders can visually assess which side—bullish or bearish—is currently exerting more significant pressure on the market over a specific period.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Amir.mq4 |
//| Copyright © 2005, Amir |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Amir"
#property link ""
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int BoxSize=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int Cur=0;
int KirUp=0;
int KirDn=0;
int kr=0;
int no=0;
double valueh=0;
double valuel=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"XOUP");
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"XODOWN");
IndicatorShortName("I-XO-A-H");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int CurrentBar;
double Hi,Lo,Curb;
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
//----Calculation---------------------------
for(int i=0;i<=Bars;i++)
{
CurrentBar = Bars-i;
if (Cur<1)
{
Hi=Close[CurrentBar];
Lo=Close[CurrentBar];
Cur=1;
}
Curb=Close[CurrentBar];
if (Curb>(Hi+BoxSize*Point))
{
Cur+=1;
Hi=Curb;
Lo=Curb-BoxSize*Point;
KirUp=1;
KirDn=0;
kr+=1;
no=0;
}
if (Curb<(Lo-BoxSize*Point))
{
Cur+=1;
Lo=Curb;
Hi=Curb+BoxSize*Point;
KirUp=0;
KirDn=1;
no+=1;
kr=0;
}
valueh=kr;
valuel=0-no;
ExtMapBuffer1[CurrentBar]=valueh;
ExtMapBuffer2[CurrentBar]=valuel;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments