Miscellaneous
0
Views
0
Downloads
0
Favorites
iMAX
/*+-------------------------------------------------------------------+
| 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
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---