Price Data Components
Indicators Used
Miscellaneous
2
Views
0
Downloads
0
Favorites
[i]2MAsame_v1
//+------------------------------------------------------------------+
//| 5 Min RSI 12-period qual INDICATOR |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link "http://www.lightpatch.com"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 Aqua
#property indicator_color4 LightGreen
#property indicator_color5 DodgerBlue
//---- buffers
double Buffer0[];
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
//+------------------------------------------------------------------+
//| 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_LINE);
SetIndexBuffer(0, Buffer0);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1, Buffer1);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, Buffer2);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3, Buffer3);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4, Buffer4);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
for( i=0; i<Bars; i++ ) Buffer0[i]=0;
for( i=0; i<Bars; i++ ) Buffer1[i]=0;
for( i=0; i<Bars; i++ ) Buffer2[i]=0;
for( i=0; i<Bars; i++ ) Buffer3[i]=0;
for( i=0; i<Bars; i++ ) Buffer4[i]=0;
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int pos=Bars-100; // leave room for moving average periods
int ctr=0;
double ma0, ma1, ma2, ma3, ma4;
double p=Point();
while(pos>=0)
{
// so we're on a HOURLY chart, and we're going to calculate
// every tick for H1, every 4th tick for H4 and
// every 24th tick for D1
ma0= iMA(Symbol(),PERIOD_M30,2 ,0,PRICE_OPEN,MODE_SMA,pos);
ma1= iMA(Symbol(),PERIOD_H1 ,2 ,0,PRICE_OPEN,MODE_SMA,pos);
ma2= iMA(Symbol(),PERIOD_H4 ,2 ,0,PRICE_OPEN,MODE_SMA,pos);
ma3= iMA(Symbol(),PERIOD_D1 ,2 ,0,PRICE_OPEN,MODE_SMA,pos);
ma4= iMA(Symbol(),PERIOD_W1 ,2 ,0,PRICE_OPEN,MODE_SMA,pos);
Buffer0[pos]=ma0;
Buffer1[pos]=ma1;
Buffer2[pos]=ma2;
Buffer3[pos]=ma3;
Buffer4[pos]=ma4;
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
---