I tried to create a Chart object in mql4, but I got a 4207 runtime error "Some error in object operation."
My creation code: ObjectCreate(0, "miniChart", OBJ_CHART, 0, Time, Bid);
Is this workable in MT4?
Thank you for your answer.
1. Thank you for your answer
2. MT4 documentation is not complete
3. I compiled this code without errors
In regards to this, it is complete! Where do you see a reference to OBJ_CHART in the MQL4 documentation (I even linked for you)? You will only find that referenced in the MQL5 documentation, which means you have been reading the wrong one!
I also checked the documentation on the Editor's Help (F1) and confirmed that there too, it is not referenced in the MQL4 help but only in the MQL5 help.
Unlike FMIC, I think that's a very reasonable point. OBJ_CHART shouldn't compile successfully in a .mq4 file, just like use of OBJ_DOESNTEXIST or OBJ_YETI or OBJ_LOCHNESSMONSTER wouldn't compile successfully.
The fact that OBJ_CHART compiles successfully and is present in MetaEditor's auto-complete for .mq4 files creates reasonable doubt as to whether the error is (a) that OBJ_CHART compiles, or (b) that the page for it is missing from docs.mql4.com.
Personally, I think you were perfectly justified in asking your original question. But, no, OBJ_CHART is not currently implemented in MT4.
The point here was about the "documentation"! I did not say anything about the "compiling" of the code, only that the OP was incorrect in stating that the documentation was at fault.
So by stating "Unlile FMIC", you are implying that I think otherwise, when in fact I did not even mention what my opinion is with regards to the "compiling" of said code.
So, the OP is NOT justified in his use of the OBJ_CHART, because had he followed only the MQL4 docs, he would not even have know about it. He read the wrong docs, hence the root of the problem!
because had he followed only the MQL4 docs, he would not even have know about it
It's in the auto-complete list when you start typing OBJ_ in MetaEditor when writing an .mq4 file. I, personally, first found out about OBJ_CHART via that route, not via the MQL5 documentation.
Like I said, it's then reasonable to question whether the auto-complete is wrong, or whether the documentation is wrong.
The editor/compiler has separate auto-complete lists for MQL4 and MQL5. For example, the list when editing .mq5 contains OrderCalcMargin() but the list when editing .mq4 list does not. The presence of OBJ_CHART in the MQL4 list is simply an error.
Similarly, the auto-complete for .mq5 has OBJ_ARROWED_LINE but .mq4 does not.
To add comments, please log in or register