Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
MBA_Thesis_Indicator_ok
#property copyright "Metatrader4 Code by jjk2. Based on MBA Thesis from Simon Fraser University written by C.E. ALDEA."
#property link ""
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DimGray
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(4);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexLabel(2,NULL);
string short_name = "ZigZag BETA Current value calculated by indicator:";
IndicatorShortName(short_name);
return(0);
}
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int limit;
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit = Bars-counted_bars;
//
//
//
//
//
for (int i=limit; i>=0; i--)
{
double MACD = iMACD(NULL,0,12,26,9,PRICE_CLOSE,0,i);
double Stoch = iStochastic(NULL,0,9,6,2,MODE_SMA,1,0,i);
double RSI = iRSI(NULL,0,9,PRICE_CLOSE,i);
double moment = iMomentum(NULL,0,9,PRICE_CLOSE,i);
if (moment != 0)
ExtMapBuffer4[i] = Stoch*(MACD+RSI)/moment;
else ExtMapBuffer4[i] = 0.00;
}
//
//
//
//
//
for (i=limit; i>=0; i--)
{
ExtMapBuffer3[i] = iMAOnArray(ExtMapBuffer4,0,2,0,MODE_SMA,i);
if (ExtMapBuffer3[i]>ExtMapBuffer3[i+1]) {
ExtMapBuffer1[i] = ExtMapBuffer3[i];
ExtMapBuffer2[i] = EMPTY_VALUE;
}
else
{
ExtMapBuffer2[i] = ExtMapBuffer3[i];
ExtMapBuffer1[i] = EMPTY_VALUE;
}
}
//
//
//
//
//
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
---