Miscellaneous
0
Views
0
Downloads
0
Favorites
INDInverse_EMAdirection
//+------------------------------------------------------------------+
//| IND Inverse direction.mq4 |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Black
#property indicator_maximum 0.25
#property indicator_minimum -0.25
double Buffer[], hist[];
extern int FastEMA = 20;
extern int SlowEMA = 50;
extern int iPeriod = 1;
//----
//+------------------------------------------------------------------+
//| Init |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);
// IndicatorDigits(Digits+2);
SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(0,hist);
SetIndexStyle(1,DRAW_NONE);
SetIndexBuffer(1,Buffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system |
//+------------------------------------------------------------------+
int start()
{
int limit, i;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0)
{
return(-1);
}
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- do it
for (i=limit-1; i>=0; i--)
{
// Easy to read
double HD = High[Highest(NULL,0,MODE_HIGH,(iPeriod* 20),i)];
double LD = Low[Lowest(NULL,0,MODE_LOW,(iPeriod* 20),i)];
double amplitude = HD - LD;
Buffer[i]= ((Close[i]-(HD-(amplitude/2)))/amplitude) * iPeriod;
}
for (i=limit-1-SlowEMA; i>=0; i--)
hist[i] = iMAOnArray (Buffer,0,FastEMA,0,MODE_EMA,i) - iMAOnArray (Buffer,0,SlowEMA,0,MODE_EMA,i);
return(0);
}
//+------------------------------------------------------------------+
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
---