Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
RollerCoaster
//+------------------------------------------------------------------+
//| RollerCoaster.mq4 |
//| Copyright © 2008, Vishal |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Vishal"
#property link ""
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Silver
#property indicator_color2 DodgerBlue
#property indicator_color3 Crimson
//---- input parameters
extern int MAperiod=21;
extern string Note_MAmethod="0=sma 1=ema 2=smma 3=lwma";
extern int MAmethod=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
counted_bars--;
int i, startbar, hh, ll;
double mavrg;
startbar = Bars - counted_bars - MAperiod;
for (i=startbar; i>=0; i--)
{
mavrg = iMA(NULL,0,MAperiod,0,MAmethod,PRICE_CLOSE,i);
ExtMapBuffer1[i] = mavrg;
if (High[i+2]==High[iHighest(NULL,0,MODE_HIGH,5,i)])
{
for (int j=i+2;j>=i;j--)
ExtMapBuffer2[j]=High[i+2];
} else ExtMapBuffer2[i] = ExtMapBuffer2[i+1];
if (Low[i+2]==Low[iLowest(NULL,0,MODE_LOW,5,i)])
{
for (int k=i+2;k>=i;k--)
ExtMapBuffer3[k]=Low[i+2];
} else ExtMapBuffer3[i] = ExtMapBuffer3[i+1];
}
//----
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
---