
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
here is the code from my indicator:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Blue
extern string Timeframe_Momentum = "PERIOD_H1";
extern int Periode_Momentum = 500;
extern int Periode_MA_Momentum = 8;
double Buffer_Mom[];
double Buffer_Ma[];
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,Buffer_Mom);
SetIndexBuffer(1,Buffer_Ma);
//----
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexDrawBegin(0,100);
SetIndexDrawBegin(1,100);
//----
return(0);
}
int deinit()
{
//----
return(0);
}
void start()
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
//----
for(int i=0; i<limit; i++)
{
Buffer_Mom[i]=iMomentum(NULL,Timeframe_Momentum,Periode_Momentum,PRICE_CLOSE,i);
Buffer_Ma[i]=iMAOnArray(Buffer_Mom,0,Periode_MA_Momentum,0,MODE_SMA,i);
}
return(0);
}
Here is the code I use in the main Programm:
double GMI1 = iCustom(NULL,0,"GMI",Timeframe_Momentum,Periode_Momentum,Periode_MA_Momentum, 0,1);
double GMI2 = iCustom(NULL,0,"GMI",Timeframe_Momentum,Periode_Momentum,Periode_MA_Momentum, 1,2);
Now my problems:
I get this error message: EURUSD,M5: invalid integer number as parameter 2 for Indicator call function
AND there is no Buffer_Ma[i] in my chart! What is wrong with my code?!