- Double Exponential Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis
- Triple Exponential Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis
- Indicators - Charts - MetaTrader 5 for Android
hello everyone first of all thank you for read my post. I have faced one problem. I am creating custom indicator that buffer[] takes value of 1(for example buffer[i]=1) when moving average is increasing. I wrote code but this error appeared "SetIndexBuffer-no one of the overloads can be applied to the function call". I do not understand this error. I believe you can fix this problem.
As it's so easy to solve, why can't you solve it yourself?
As it's so easy to solve, why can't you solve it yourself?
If you know help bro. For me it is very hard
hello everyone first of all thank you for read my post. I have faced one problem. I am creating custom indicator that buffer[] takes value of 1(for example buffer[i]=1) when moving average is increasing. I wrote code but this error appeared "SetIndexBuffer-no one of the overloads can be applied to the function call". I do not understand this error. I believe you can fix this problem.
not so easy if you don't attach the code
not so easy if you don't attach the code
#property copyright ""
#property link ""
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 1
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int buffercond1[];
double ma_0;
double ma_1;
double ma_2;
double ma_3;
double ma_4;
double ma_5;
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,buffercond1);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit=rates_total-prev_calculated;
for(int i=0;i<=limit;i++)
{
ma_0=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i);
ma_1=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i+1);
ma_2=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i+2);
ma_3=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i+3);
ma_4=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i+4);
ma_5=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i+5);
if(ma_5>ma_2 && ma_4>ma_1 && ma_3>ma_0)
{
buffercond1[i]=1;
printf("buffercond1=",buffercond1[i]);
}
else
{
buffercond1[i]=0;
printf("buffercond1=",buffercond1[i]);
}
}
//--- return value of prev_calculated for next call
return(rates_total);
}
change from integer to double in this line
int buffercond1[];
and you should use the source code button to attach code in future, makes it much easy to see.

- www.mql5.com
change from integer to double in this line
int buffercond1[];
and you should use the source code button to attach code in future, makes it much easy to see.
my friend when i activate my indicator this"array out of range in 'indicator2.mq4' " message appeared on Experts menu. How to solve it?
my friend when i activate my indicator this"array out of range in 'indicator2.mq4' " message appeared on Experts menu. How to solve it?
you really need to go spend some time with the documentation www.mql4.com as no doubt there will be another error after this one etc..
an array out of range is quite simple to fix you are simply requesting an array index that does not exist like asking for Item[10] when the array Item only has 5 elements.
and remember arrays start at zero.
you really need to go spend some time with the documentation www.mql4.com as no doubt there will be another error after this one etc..
an array out of range is quite simple to fix you are simply requesting an array index that does not exist like asking for Item[10] when the array Item only has 5 elements.
and remember arrays start at zero.
pls just help to run this indicator i never ask again
pls just help to run this indicator i never ask again
change for(int i=0;i<=limit;i++)
to for(int i=0;i<limit;i++)
change for(int i=0;i<=limit;i++)
to for(int i=0;i<limit;i++)
i run it at 1Minute timeframe but it can not print text of "buffercond1=0". why

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use