This tool is designed to provide visual clarity on trading charts by identifying specific price trends and key historical levels. It functions by layering three distinct types of information onto your screen, helping you visualize market momentum and significant "peaks" or "valleys."
Here is a breakdown of how the logic works:
1. Trend Foundation (The Moving Average)
The core of the indicator begins by calculating a Moving Average based on a user-defined number of previous candles. This acts as a baseline, smoothing out the "noise" of minor price fluctuations to show the general direction of the market. By looking at these averages, you can see whether the overall trend is leaning upwards, downwards, or remaining sideways.
2. Dynamic Highs (The Ceiling)
The script continuously scans a specific window of recent price action to identify "highest highs." When the tool detects a new peak that surpasses previous levels within its immediate look-back range, it marks that point. This creates a visual path that follows the highest prices reached. It essentially draws a line that tracks the "ceiling" of the market's movement, allowing you to see where the price has struggled to break through.
3. Dynamic Lows (The Floor)
Mirroring the logic used for highs, the indicator also scans for "lowest lows." When it identifies a new significant drop in price within its designated window, it marks that point. This creates a visual path following the "floor" of the market's movement. By observing this line, you can see where the price has found support or reached bottom levels during a decline.
Summary of Visual Behavior
When you view this on a chart, you aren't just seeing one line; you are seeing a multi-layered map of market behavior:
- The Moving Average tells you the general "flow."
- The Highs show you where the most aggressive buying pressure occurred.
- The Lows show you where the most significant selling pressure bottomed out.
By combining these three elements, the tool allows a trader to see the relationship between the current trend and the most important historical price boundaries formed in the recent past.
//+------------------------------------------------------------------+
//| RollerCoaster.mq4 |
//| Copyright © 2008, Vishal |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Vishal"
#property link ""
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Silver
#property indicator_color2 DodgerBlue
#property indicator_color3 Crimson
//---- input parameters
extern int MAperiod=21;
extern string Note_MAmethod="0=sma 1=ema 2=smma 3=lwma";
extern int MAmethod=0;
//---- 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,STYLE_DOT);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
counted_bars--;
int i, startbar, hh, ll;
double mavrg;
startbar = Bars - counted_bars - MAperiod;
for (i=startbar; i>=0; i--)
{
mavrg = iMA(NULL,0,MAperiod,0,MAmethod,PRICE_CLOSE,i);
ExtMapBuffer1[i] = mavrg;
if (High[i+2]==High[iHighest(NULL,0,MODE_HIGH,5,i)])
{
for (int j=i+2;j>=i;j--)
ExtMapBuffer2[j]=High[i+2];
} else ExtMapBuffer2[i] = ExtMapBuffer2[i+1];
if (Low[i+2]==Low[iLowest(NULL,0,MODE_LOW,5,i)])
{
for (int k=i+2;k>=i;k--)
ExtMapBuffer3[k]=Low[i+2];
} else ExtMapBuffer3[i] = ExtMapBuffer3[i+1];
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments