Aroon_Horn2
Download scriptThis tool is designed to help traders visualize the strength of a market trend by measuring how recently the price has reached new highs or lows within a specific timeframe. Instead of just looking at the current price, it analyzes the momentum of the movement over a set number of candles (defaulting to 10).
How the Logic Works
The script monitors two distinct movements simultaneously: the "Upward Strength" and the "Downward Strength." It functions by looking back into the past to identify exactly where the highest and lowest points occurred during the chosen period.
1. Measuring Upward Momentum (Aroon Up) The logic identifies the most recent peak in price. It calculates how far back that peak occurred relative to the current time. If the highest price was reached very recently, it indicates strong upward momentum, resulting in a higher value on the indicator. Conversely, if the peak happened a long time ago, the upward strength is considered weak.
2. Measuring Downward Momentum (Aroon Down) The script performs the same calculation for the lowest price points. It looks for how recently the market hit a bottom. If the lowest price occurred very recently, it signals strong downward pressure. The further back that "bottom" was, the weaker the current downward trend is perceived to be.
3. Visual Representation The results are plotted as two separate lines in a dedicated window on your trading platform:
- Aroon Up: Represents the intensity of the bullish (buying) trend.
- Aroon Down: Represents the intensity of the bearish (selling) trend.
Purpose for the Trader
By observing these two lines, traders can get a clearer sense of market "health." When one line is significantly higher than the other, it suggests that the market is favoring a specific direction. The tool effectively translates time and price extremes into a simplified visual format, allowing you to see at a glance whether the market is trending strongly in one direction or if it is moving sideways with no clear momentum.
//+------------------------------------------------------------------+
//| Aroon_Horn.mq4 |
//| tonyc2a@yahoo.com |
//| |
//+------------------------------------------------------------------+
#property copyright "tonyc2a@yahoo.com"
#property link "mailto:tonyc2a@yahoo.com"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
extern int Aroon_Period=10;
double Buffer1[];
double Buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0,Buffer1);
SetIndexLabel(0,"Aroon Up");
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buffer2);
SetIndexLabel(1,"Aroon Down");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//---- TODO: add your code here
double HighestBar,LowestBar,aroonUp,aroonDn;
for(int shift=Bars-Aroon_Period;shift>=0;shift--){
HighestBar = Highest(Symbol(),0,MODE_HIGH,Aroon_Period-1,shift);
LowestBar = Lowest(Symbol(),0,MODE_LOW,Aroon_Period-1,shift);
aroonUp = 100 - ((HighestBar - shift) / Aroon_Period) * 100;
aroonDn = 100 - ((LowestBar - shift) / Aroon_Period) * 100;
if(aroonUp == 0) { aroonUp = 0.0000001; }
if(aroonDn == 0) { aroonDn = 0.0000001; }
Buffer1[shift]=aroonUp;
Buffer2[shift]=aroonDn;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments