Download MetaTrader 5
To add comments, please log in or register
MQL5 library has more than 1500 apps already. Contribute your own one!
LEE Chun Wing
747
LEE Chun Wing 2010.07.06 10:29 

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 

LEE Chun Wing
747
LEE Chun Wing 2010.07.06 10:52  
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

Paul
784
Paul 2010.07.06 10:53  
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[];

 

MT5_User
3
MT5_User 2012.04.05 15:33  

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. 

 

/
To add comments, please log in or register