Discussion of article "Migrating from MQL4 to MQL5" - page 10 1...345678910111213 New comment Vitaly Muzichenko 2017.07.08 02:46 #91 -Aleks-:I can't understand how to use the functionThe compiler warns'OBJPROP_TIME1' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2891 12'OBJPROP_TIME1' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2891 12'OBJPROP_PRICE1' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2893 12'OBJPROP_PRICE1' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2893 12'OBJPROP_TIME2' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2895 12'OBJPROP_TIME2' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2895 12'OBJPROP_PRICE2' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2897 12'OBJPROP_PRICE2' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2897 12'OBJPROP_TIME3' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2899 12'OBJPROP_TIME3' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2899 12'OBJPROP_PRICE3' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2901 12'OBJPROP_PRICE3' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2901 12Change ObjectSetInteger(...) to ObjectSetMQL4(...) in the lines where the error occurs.In general, it's easier to rewrite, it's very fast to change there, literally 2 minutes of time Aleksey Vyazmikin 2017.07.08 20:52 #92 Vitaly Muzichenko:Change ObjectSetInteger(...) to ObjectSetMQL4(...) in the lines where the error occurs.In general, it's easier to rewrite, it's very fast to change it there, literally 2 minutes of timeI don't understand or it doesn't work.I had such a function//+------------------------------------------------------------------+ //|Function for displaying information on the screen| //+------------------------------------------------------------------+ void Label(string _name,int _window,int _x,int _y,string _text,int _font,color _color,int corner) { ObjectDelete(0,_name); ObjectCreate(0,_name,OBJ_LABEL,_window,0,0); ObjectSet(_name,OBJPROP_CORNER,corner); ObjectSet(_name,OBJPROP_XDISTANCE,_x); ObjectSet(_name,OBJPROP_YDISTANCE,_y); ObjectSetText(_name,_text,_font,"Arial",_color); }To make it work in MQL5, I added from the article bool ObjectSetText(string name, string text, int font_size,string font="", color text_color=CLR_NONE) { int tmpObjType=(int)ObjectGetInteger(0,name,OBJPROP_TYPE); if(tmpObjType!=OBJ_LABEL && tmpObjType!=OBJ_TEXT) return(false); if(StringLen(text)>0 && font_size>0) { if(ObjectSetString(0,name,OBJPROP_TEXT,text)==true && ObjectSetInteger(0,name,OBJPROP_FONTSIZE,font_size)==true) { if((StringLen(font)>0) && ObjectSetString(0,name,OBJPROP_FONT,font)==false) return(false); if(text_color>-1 && ObjectSetInteger(0,name,OBJPROP_COLOR,text_color)==false) return(false); return(true); } return(false); } return(false); } bool ObjectSet(string name, int index, double value) { switch(index) { case OBJPROP_TIME1: ObjectSetInteger(0,name,OBJPROP_TIME,(int)value);return(true); case OBJPROP_PRICE1: ObjectSetDouble(0,name,OBJPROP_PRICE,value);return(true); case OBJPROP_TIME2: ObjectSetInteger(0,name,OBJPROP_TIME,1,(int)value);return(true); case OBJPROP_PRICE2: ObjectSetDouble(0,name,OBJPROP_PRICE,1,value);return(true); case OBJPROP_TIME3: ObjectSetInteger(0,name,OBJPROP_TIME,2,(int)value);return(true); case OBJPROP_PRICE3: ObjectSetDouble(0,name,OBJPROP_PRICE,2,value);return(true); case OBJPROP_COLOR: ObjectSetInteger(0,name,OBJPROP_COLOR,(int)value);return(true); case OBJPROP_STYLE: ObjectSetInteger(0,name,OBJPROP_STYLE,(int)value);return(true); case OBJPROP_WIDTH: ObjectSetInteger(0,name,OBJPROP_WIDTH,(int)value);return(true); case OBJPROP_BACK: ObjectSetInteger(0,name,OBJPROP_BACK,(int)value);return(true); case OBJPROP_RAY: ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,(int)value);return(true); case OBJPROP_ELLIPSE: ObjectSetInteger(0,name,OBJPROP_ELLIPSE,(int)value);return(true); case OBJPROP_SCALE: ObjectSetDouble(0,name,OBJPROP_SCALE,value);return(true); case OBJPROP_ANGLE: ObjectSetDouble(0,name,OBJPROP_ANGLE,value);return(true); case OBJPROP_ARROWCODE: ObjectSetInteger(0,name,OBJPROP_ARROWCODE,(int)value);return(true); case OBJPROP_TIMEFRAMES: ObjectSetInteger(0,name,OBJPROP_TIMEFRAMES,(int)value);return(true); case OBJPROP_DEVIATION: ObjectSetDouble(0,name,OBJPROP_DEVIATION,value);return(true); case OBJPROP_FONTSIZE: ObjectSetInteger(0,name,OBJPROP_FONTSIZE,(int)value);return(true); case OBJPROP_CORNER: ObjectSetInteger(0,name,OBJPROP_CORNER,(int)value);return(true); case OBJPROP_XDISTANCE: ObjectSetInteger(0,name,OBJPROP_XDISTANCE,(int)value);return(true); case OBJPROP_YDISTANCE: ObjectSetInteger(0,name,OBJPROP_YDISTANCE,(int)value);return(true); case OBJPROP_FIBOLEVELS: ObjectSetInteger(0,name,OBJPROP_LEVELS,(int)value);return(true); case OBJPROP_LEVELCOLOR: ObjectSetInteger(0,name,OBJPROP_LEVELCOLOR,(int)value);return(true); case OBJPROP_LEVELSTYLE: ObjectSetInteger(0,name,OBJPROP_LEVELSTYLE,(int)value);return(true); case OBJPROP_LEVELWIDTH: ObjectSetInteger(0,name,OBJPROP_LEVELWIDTH,(int)value);return(true); default: return(false); } return(false); } I got the above described errors. Vitaly Muzichenko 2017.07.08 22:29 #93 -Aleks-:I don't get it or it doesn't work.I had this functionIn order for it to work in MQL5, I added from the article. And I got the above described errors.Such constructions should have been flushed down the toilet back in 2013. ObjectSet(_name,OBJPROP_CORNER,corner); ObjectSet(_name,OBJPROP_XDISTANCE,_x); ObjectSet(_name,OBJPROP_YDISTANCE,_y); ObjectSetText(_name,_text,_font,"Arial",_color);Use:ObjectSetDouble(...) ObjectSetInteger(...) Aleksey Vyazmikin 2017.07.08 22:46 #94 Vitaly Muzichenko:These are the kind of designs that should have been flushed down the toilet back in 2013Use it:Thank you. I understood that in my case I need to put ObjectSetInteger everywhere . Vitaly Muzichenko 2017.07.08 22:47 #95 -Aleks-:Thank you. I understand that in my case I need to put ObjectSetInteger everywhere .Absolutely.The help describes everything perfectly well, where Integer is needed and where Dooble is needed Aleksey Vyazmikin 2017.07.08 22:57 #96 Vitaly Muzichenko:Absolutely.The help describes everything perfectly well, where Integer is needed and where Dooble is neededI was a bit confused with the help because I didn't know much about working with objects before and I borrowed the function.... Vitaly Muzichenko 2017.07.08 22:59 #97 -Aleks-:I was stupid with the help - as I didn't know much about working with objects before, but I borrowed the function....Borrow from new branches and advisors. Do not borrow from the branches of 2007) Aleksey Vyazmikin 2017.07.08 23:34 #98 Vitaly Muzichenko:Borrow from new branches and advisors. Don't borrow from the 2007 branches)This borrowing was in 2013 - just moving from one place to another... pa-fx 2017.08.10 14:55 #99 Please advise how to work with iFractalsMQL4 for (int i=0; i<np; i++) //character cycle { m_symbols[i].Refresh(); for (int ii=2;ii<=3;ii++) //cycle to the first fractal { double dF=0; int TMODE=1; dF = iFractalsMQL4(Pairs[i],PERIOD_D1,TMODE,ii); Print("i ",i," ii ",ii," Pairs[i] ",Pairs[i]," TMODE ",TMODE," dF ",dF); } } Result:2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 0 ii 2 Pairs[i] AUDCAD_i TMODE 1 dF 1.00731 2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 0 ii 3 Pairs[i] AUDCAD_i TMODE 1 dF 1.797693134862316e+308 2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 1 ii 2 Pairs[i] AUDCHF_i TMODE 1 dF 1.797693134862316e+308 ...That is, iFractalsMQL4 works at the first call, but then it does not.CSymbolInfo m_symbols[]; // symbol info object and m_symbols[i].Refresh(); are not correct. What should be done? Indicators: MACD Divergence Strategy Tester does not Showing Trades on Custom Yohana Parmi 2017.09.16 16:24 #100 Thank you,Your hard work in this article is very helpful :) 1...345678910111213 New comment
I can't understand how to use the function
The compiler warns
'OBJPROP_TIME1' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2891 12
'OBJPROP_TIME1' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2891 12
'OBJPROP_PRICE1' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2893 12
'OBJPROP_PRICE1' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2893 12
'OBJPROP_TIME2' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_TIME2' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2895 12
'OBJPROP_PRICE2' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2897 12
'OBJPROP_PRICE2' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2897 12
'OBJPROP_TIME3' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2899 12
'OBJPROP_TIME3' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2899 12
'OBJPROP_PRICE3' - undeclared identifier TZ_Sky_and_Ground_V_04.mq5 2901 12
'OBJPROP_PRICE3' - constant expression required TZ_Sky_and_Ground_V_04.mq5 2901 12
Change ObjectSetInteger(...) to ObjectSetMQL4(...) in the lines where the error occurs.
In general, it's easier to rewrite, it's very fast to change there, literally 2 minutes of time
Change ObjectSetInteger(...) to ObjectSetMQL4(...) in the lines where the error occurs.
In general, it's easier to rewrite, it's very fast to change it there, literally 2 minutes of time
I don't understand or it doesn't work.
I had such a function
To make it work in MQL5, I added from the article
I got the above described errors.
I don't get it or it doesn't work.
I had this function
In order for it to work in MQL5, I added from the article.
And I got the above described errors.
Such constructions should have been flushed down the toilet back in 2013.
Use:
These are the kind of designs that should have been flushed down the toilet back in 2013
Use it:
Thank you. I understood that in my case I need to put ObjectSetInteger everywhere .
Thank you. I understand that in my case I need to put ObjectSetInteger everywhere .
Absolutely.
The help describes everything perfectly well, where Integer is needed and where Dooble is needed
Absolutely.
The help describes everything perfectly well, where Integer is needed and where Dooble is needed
I was a bit confused with the help because I didn't know much about working with objects before and I borrowed the function....
I was stupid with the help - as I didn't know much about working with objects before, but I borrowed the function....
Borrow from new branches and advisors. Do not borrow from the branches of 2007)
Borrow from new branches and advisors. Don't borrow from the 2007 branches)
This borrowing was in 2013 - just moving from one place to another...
Please advise how to work with iFractalsMQL4
Result:
2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 0 ii 2 Pairs[i] AUDCAD_i TMODE 1 dF 1.00731
2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 0 ii 3 Pairs[i] AUDCAD_i TMODE 1 dF 1.797693134862316e+308
2017.08.10 17:28:23.458 TwoFingersSymbolsExp_v1.03_my_pa (_DJI,M5) i 1 ii 2 Pairs[i] AUDCHF_i TMODE 1 dF 1.797693134862316e+308 ...
That is, iFractalsMQL4 works at the first call, but then it does not.
CSymbolInfo m_symbols[]; // symbol info object
and
m_symbols[i].Refresh();
are not correct. What should be done?
Thank you,
Your hard work in this article is very helpful :)