iMAX
Download scriptOverview of the iMAX Indicator Logic
The iMAX script is a technical analysis tool designed to help traders identify trends and potential price movements by smoothing out market "noise." It utilizes a sophisticated mathematical approach known as the Modified Optimum Elliptic Filter, which is engineered to provide a clearer picture of price action without the significant delays often found in traditional moving averages.
Core Methodology
The primary goal of this indicator is Optimal Detrending. In simple terms, financial markets are constantly fluctuating with minor ups and downs (noise) that can sometimes obscure the larger, more meaningful trend. This script works by mathematically analyzing the relationship between the highest and lowest prices over a specific timeframe to "filter out" those distractions.
How the Logic Works
The indicator processes data through several key stages:
- Price Range Analysis: The tool looks at the "High" and "Low" price points of recent candles. By focusing on these extremes rather than just the closing price, it captures the full range of market volatility.
- Weighted Calculation: It applies specific mathematical weights to different periods of time. This means it gives more importance to the most recent price actions while still considering a history of previous price movements to maintain stability.
- Recursive Smoothing: The script uses a "recursive" logic, meaning that each new calculation takes into account its own previous results. This creates a fluid, continuous line that adjusts dynamically as new data arrives.
- Dual-Line Visualization: The indicator produces two distinct visual lines on your chart:
- The Primary Signal (Aqua): This represents the main filtered trend of the price.
- The Shifted Signal (Red): This is a secondary line derived from the primary signal but shifted slightly forward or backward (based on the user-defined settings).
Practical Application
By plotting these two lines, the indicator allows traders to visualize the momentum of the market. When the lines move in specific directions or interact with one another, they serve as visual cues for the underlying strength of a trend. Because it is based on an "Elliptic Filter," the result is a line that aims to stay as close to the actual price action as possible while remaining smooth enough to help traders avoid making impulsive decisions based on temporary price spikes.
/*+-------------------------------------------------------------------+
| iMAX.mq4 |
| |
| "Modified Optimum Elliptic Filter" |
| Source of calculations: |
| Stocks & Commodities vol 18:7 p20-29 |
| Optimal Detrending by John F. Ehlers |
| |
| Coded by Wylie |
| dazzle.html@live.com |
+-------------------------------------------------------------------+*/
#property copyright "Wylie"
#property link "dazzle.html@live.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
extern int Ph2shiftRed = 1;
int buffers = 2;
int MinBars;
double ExtMapBuffer0[];
double ExtMapBuffer1[];
int init()
{
IndicatorBuffers(2);
// Index Buffer 0
SetIndexBuffer(0,ExtMapBuffer0);
SetIndexShift(0,0);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Aqua);
// Index Buffer 1
SetIndexBuffer(1,ExtMapBuffer1);
SetIndexShift(1,0);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorShortName("iMAX");
MinBars = 20;
return (0);
} // int init()
int start()
{
if(Bars <= MinBars){return (0);}
int countedBars = IndicatorCounted();
if(countedBars < 0){return (-1);}
if(countedBars > 0){countedBars--;}
int c,limit = Bars - countedBars - 1;
double x = 0.5;
for(c = limit;c >= 0;c--)
{ExtMapBuffer0[c] = (0.13785 * (2 * ((High[c] + Low[c]) * x) - ((High[c+1] + Low[c+1]) * x)))
+ (0.0007 * (2 * ((High[c+1] + Low[c+1]) * x) - ((High[c+2] + Low[c+2]) * x)))
+ (0.13785 * (2 * ((High[c+2] + Low[c+2]) * x) - ((High[c+3] + Low[c+3]) * x)))
+ (1.2103 * ExtMapBuffer0[c + 1] - 0.4867 * ExtMapBuffer0[c + 2]);
ExtMapBuffer1[c] = ExtMapBuffer0[c+Ph2shiftRed];
} // for(c = limit;c >= 0;c--)
return (0);
} // int start()
/*+-------------------------------------------------------------------+
| |
+-------------------------------------------------------------------+*/
Comments