no one of the overloads can be applied to the function call??

 

in mql4, i can use iTime[1] to get bar[1] opentime ,

 

in mql5 , i use below sentence

 CopyTime(Symbol(),PERIOD_CURRENT,1,1,from);

 

 but i get  compile error:

no one of the overloads can be applied to the function call

 

how to solve

thanks 

 
kelly:

in mql4, i can use iTime[1] to get bar[1] opentime ,

 

in mql5 , i use below sentence

 CopyTime(Symbol(),PERIOD_CURRENT,1,1,from);

 

 but i get  compile error:

no one of the overloads can be applied to the function call

 

how to solve

thanks 

oh, i knew the mistake i commit : wrong parameter type that i decl"are

"from" should be datetime array  , not double

 
kelly:

in mql4, i can use iTime[1] to get bar[1] opentime ,

 

in mql5 , i use below sentence

 CopyTime(Symbol(),PERIOD_CURRENT,1,1,from);

 

 but i get  compile error:

no one of the overloads can be applied to the function call

 

how to solve

thanks 

My guess is that the variable 'from' is not declared properly

datetime from[1];
// or, if 'from' will be used for variable numbers of bars in other CopyTime calls
datetime from[];

 

 

Hi,

I can't see a place to open a new topic so I'll ask here. This code was working in MQl4 and I'm trying to convert to MQL5. I've read the conversion articles, searched, and modified it a bit yet I'm still getting error messages.

objectsetdouble : "no one of the overloads can be applied to the function call" (this was also on the second ObjectSet until I changed it to 'integer').

It also seems to be necessary to add 'Return(0);' or something like that, which wasn't necessary in MQL4 when the function was only used for ex drawing on the chart and not calculating a value to return.  

int draw(string symbol, int _, int window, int shift, double value, color colour, int code){
    string draw; StringConcatenate(draw,value,shift); datetime Time[]; datetime time = Time[shift];
    ObjectCreate(0,draw,22,window,time,value); ObjectSetDouble(0,draw,OBJPROP_COLOR,colour); ObjectSetInteger(0,draw,OBJPROP_ARROWCODE,code);
    return(0);}

int trend(string symbol, int _, int window, int shift_1, double price_1, int shift_2, double price_2, color colour){datetime iTimeMQL4(symbol,_,shift_1);
    string trend; StringConcatenate(trend,price_1,shift_1,price_2); datetime time_1 = iTimeMQL4, time_2 = iTime(symbol,_,shift_2);
    ObjectCreate(0,trend,OBJ_TREND,window,time_1,price_1,time_2,price_2); ObjectSetDouble(0,trend,OBJPROP_COLOR,colour);}

for the second function I tried to replace iTime with iTimeMQL4 but I get 'class type expected', so if someone could tell me how to replace iTime from MQL4 that would be appreciated. 

 
MT5_User:

Hi,

I can't see a place to open a new topic so I'll ask here. This code was working in MQl4 and I'm trying to convert to MQL5. I've read the conversion articles, searched, and modified it a bit yet I'm still getting error messages.

objectsetdouble : "no one of the overloads can be applied to the function call" (this was also on the second ObjectSet until I changed it to 'integer').

It also seems to be necessary to add 'Return(0);' or something like that, which wasn't necessary in MQL4 when the function was only used for ex drawing on the chart and not calculating a value to return.  

for the second function I tried to replace iTime with iTimeMQL4 but I get 'class type expected', so if someone could tell me how to replace iTime from MQL4 that would be appreciated. 

Does changing the function definition to void make a difference?

If you are not expecting a returned value from the function, perhaps this will work:

void draw(string symbol, int _, int window, int shift, double value, color colour, int code){
    string draw; StringConcatenate(draw,value,shift); datetime Time[]; datetime time = Time[shift];
    ObjectCreate(0,draw,22,window,time,value); ObjectSetDouble(0,draw,OBJPROP_COLOR,colour); ObjectSetInteger(0,draw,OBJPROP_ARROWCODE,code);
    return(0);}

void trend(string symbol, int _, int window, int shift_1, double price_1, int shift_2, double price_2, color colour){datetime iTimeMQL4(symbol,_,shift_1);
    string trend; StringConcatenate(trend,price_1,shift_1,price_2); datetime time_1 = iTimeMQL4, time_2 = iTime(symbol,_,shift_2);
    ObjectCreate(0,trend,OBJ_TREND,window,time_1,price_1,time_2,price_2); ObjectSetDouble(0,trend,OBJPROP_COLOR,colour);}
 
MT5_User: I can't see a place to open a new topic so I'll ask here. …I tried to replace iTime with iTimeMQL4
  1. New Topic

    Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.

  2. Why? MT5 has iTime.
              New MetaTrader 5 Platform build 1860: MQL5 functions for operations with bars and Strategy Tester improvements - MQL5 programming forum 2018.06.14
              MQL5 ReferenceTimeseries and Indicators Access
 

I actually have this exact problem and I cannot understand how I'm supposed to fix it. There are two overloads with the same signature it seems, but it shouldn't throw this error in my opinion because there is no ambiguity, CArrayList implements ICollection...



 
Ian Worthington #:

I actually have this exact problem and I cannot understand how I'm supposed to fix it. There are two overloads with the same signature it seems, but it shouldn't throw this error in my opinion because there is no ambiguity, CArrayList implements ICollection...



It's because I need to write 'Add(new CustomIndicator...)"

 
Ian Worthington #:

It's because I need to write 'Add(new CustomIndicator...)"


new in red box.