And the indicator:
Code:
//+------------------------------------------------------------------+
//| Stoch_MA.mq4 |
//| davdkh Copyright © 2008 |
//| |
//+------------------------------------------------------------------+
#property copyright "davdkh Copyright © 2008"
#property link ""
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[1000];
double ExtMapBuffer2[1000];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorDigits(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
string short_name = "Stoch_MA is running";
IndicatorShortName(short_name);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int bar, limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();
for(bar=0; bar<limit; bar++)
ExtMapBuffer1[bar]=iStochastic(Symbol(),0,40,1,7,MODE_EMA,1,MODE_MAIN,bar);
for(bar=0; bar<limit; bar++)
ExtMapBuffer2[bar]=iMAOnArray(ExtMapBuffer1,Bars,60,0,MODE_EMA,bar);
//----
return(0);
}
//+------------------------------------------------------------------+