Hi Guys,
I am playing with the iMAOnArray function but am unable to get the following indicator to have an output. The indicator window that I drag this into stays blank.
Any help appreciated.
Regards
Steve
//+------------------------------------------------------------------+
//| iMAOnArray.mq4 |
//| Coders Guru |
//| http://www.metatrader.info |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "http://www.metatrader.info"
#property indicator_separate_window
#property indicator_color1 LawnGreen
#property indicator_color2 DarkBlue
double ExtMapBuffer1[];
double RSI_Val[];
double RSI_Val_SMA[];
int init()
{
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int bar, limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();
for(bar=0; bar<limit; bar++)
RSI_Val[bar] = iCustom(NULL, 0, "RSI",0,0,bar);
for(bar=0; bar<limit; bar++)
RSI_Val_SMA[bar]=iMAOnArray(RSI_Val,Bars,5,0,MODE_SMA,bar);
for(bar=0; bar<limit; bar++){
if(RSI_Val[bar]>RSI_Val_SMA[bar])
ExtMapBuffer1[bar] = 1;
else
ExtMapBuffer1[bar] = 0;
}
return(0);
}
I am playing with the iMAOnArray function but am unable to get the following indicator to have an output. The indicator window that I drag this into stays blank.
Any help appreciated.
Regards
Steve
//+------------------------------------------------------------------+
//| iMAOnArray.mq4 |
//| Coders Guru |
//| http://www.metatrader.info |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "http://www.metatrader.info"
#property indicator_separate_window
#property indicator_color1 LawnGreen
#property indicator_color2 DarkBlue
double ExtMapBuffer1[];
double RSI_Val[];
double RSI_Val_SMA[];
int init()
{
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int bar, limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();
for(bar=0; bar<limit; bar++)
RSI_Val[bar] = iCustom(NULL, 0, "RSI",0,0,bar);
for(bar=0; bar<limit; bar++)
RSI_Val_SMA[bar]=iMAOnArray(RSI_Val,Bars,5,0,MODE_SMA,bar);
for(bar=0; bar<limit; bar++){
if(RSI_Val[bar]>RSI_Val_SMA[bar])
ExtMapBuffer1[bar] = 1;
else
ExtMapBuffer1[bar] = 0;
}
return(0);
}