stoneaxe_x4x_667
Download scriptThis tool is designed as a visual momentum and trend oscillator that helps traders identify where the current price sits relative to recent market highs and lows. Unlike standard indicators that might only look at closing prices, this script evaluates the "range" of price action over three different time horizons simultaneously.
Core Logic and Mechanics
The indicator operates by calculating the relative position of the current market price within a specific window of past data. It performs this calculation across three distinct scales (defined by the parameters N1, N2, and N3), creating three separate visual lines:
- Short-Term Dynamics (N1): This focuses on very recent price action. It identifies the highest and lowest points over a small number of candles to show immediate fluctuations.
- Medium-Term Dynamics (N2): This smooths out the "noise" by looking at a larger window of candles, providing a clearer picture of the current trend.
- Long-Term Dynamics (N3): This captures the broader market structure, identifying major highs and lows to show where the price stands in the context of a much larger cycle.
How the Calculation Works
For each of these three timeframes, the script performs a specialized calculation:
- It identifies the highest high and the lowest low reached during that specific period.
- It determines how far the current closing price is from that bottom point.
- It expresses that distance as a percentage of the total range between the high and the low.
Visual Interpretation
The results are plotted in a separate window below your main chart. The logic converts these percentages into a scale centered around zero:
- When the line moves toward the upper levels, it indicates that the price is currently pushing closer to its recent highs (bullish momentum).
- When the line drops toward the lower levels, it indicates the price is hugging its recent lows (bearish momentum).
- By comparing all three lines at once, a trader can see if short-term momentum is aligning with long-term trends or if a temporary "rebound" is occurring against the broader market direction.
//+------------------------------------------------------------------+
//| StoneAxe_x4x.mq4 |
//| from MetaStock by Rosh |
//| http://forexsystems.ru/phpBB/index.php |
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link "http://www.investo.ru/forum/viewtopic.php?t=125389&postdays=0&postorder=asc&start=75"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Blue
#property indicator_level1 0.0
#property indicator_level2 0.75
#property indicator_level3 -0.75
//---- input parameters
extern int N1=8;
extern int N2=24;
extern int N3=89;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit,shift;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(-1);
if (counted_bars>=0) limit=Bars-counted_bars;
if (counted_bars==0) limit=Bars-N3;
limit--;
//----
for(shift=limit;shift>=0;shift--)
{
ExtMapBuffer1[shift]=2*(Close[shift]-Low[Lowest(NULL,0,MODE_LOW,N1,shift)])/(High[Highest(NULL,0,MODE_HIGH,N1,shift)]-Low[Lowest(NULL,0,MODE_LOW,N1,shift)])-1.0;
ExtMapBuffer2[shift]=2*(Close[shift]-Low[Lowest(NULL,0,MODE_LOW,N2,shift)])/(High[Highest(NULL,0,MODE_HIGH,N2,shift)]-Low[Lowest(NULL,0,MODE_LOW,N2,shift)])-1.0;
ExtMapBuffer3[shift]=2*(Close[shift]-Low[Lowest(NULL,0,MODE_LOW,N3,shift)])/(High[Highest(NULL,0,MODE_HIGH,N3,shift)]-Low[Lowest(NULL,0,MODE_LOW,N3,shift)])-1.0;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments