Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
[i]2MA
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 5 Min RSI 12-period qual INDICATOR |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link "http://www.lightpatch.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
//---- buffers
double Buffer1[];
double Buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
// 233 up arrow
// 234 down arrow
// 159 big dot
// 158 little dot
// 168 open square
// 120 box with X
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0, Buffer1);
SetIndexArrow(0,233);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1, Buffer2);
SetIndexArrow(1,234);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
for( i=0; i<Bars; i++ ) Buffer1[i]=0;
for( i=0; i<Bars; i++ ) Buffer2[i]=0;
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int pos=Bars-100; // leave room for moving average periods
int ctr=0;
double emaM, emaS;
double PemaM, PemaS;
double p=Point();
while(pos>=1)
{
emaM= iMA(Symbol(),PERIOD_H4, 15,0,PRICE_OPEN,MODE_EMA,pos);
emaS= iMA(Symbol(),PERIOD_H4,100,0,PRICE_OPEN,MODE_EMA,pos);
PemaM=iMA(Symbol(),PERIOD_H4, 15,0,PRICE_OPEN,MODE_EMA,pos+1);
PemaS=iMA(Symbol(),PERIOD_H4,100,0,PRICE_OPEN,MODE_EMA,pos+1);
if (PemaM<emaS && emaM>emaS) {Buffer1[pos]=High[pos]+(50*p);}
if (PemaM>emaS && emaM<emaS) {Buffer2[pos]=Low[pos]-(50*p);}
pos--;
}
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
---