Download MetaTrader 5
To add comments, please log in or register
They are already making profit using the Market. You can join them!
Wennington1
13
Wennington1 2016.09.19 07:25 

Dear Support,

 

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[0], Bid);

Is this workable in MT4?

 

Thank you for your answer. 

Fernando Carreiro
1571
Fernando Carreiro 2016.09.19 08:46  
  1. Please note that this is not a Support Forum, but a User Forum. In other words, this is not the MetaQuotes Service Desk and the people here are normal users and not usually affiliated with MetaQuotes.
  2. You should check the documentation on object types, and in the this case, you will find that "OBJ_CHART" is not available in MQL4 and is strictly an MQL5 object type.
  3. Since you have not provided any other code which will allow us to compile and test, in order to duplicate the situation, we are unable to provide any further assistance.
Wennington1
13
Wennington1 2016.09.19 09:18  
FMIC:
  1. Please note that this is not a Support Forum, but a User Forum. In other words, this is not the MetaQuotes Service Desk and the people here are normal users and not usually affiliated with MetaQuotes.
  2. You should check the documentation on object types, and in the this case, you will find that "OBJ_CHART" is not available in MQL4 and is strictly an MQL5 object type.
  3. Since you have not provided any other code which will allow us to compile and test, in order to duplicate the situation, we are unable to provide any further assistance.

1. Thank you for your answer

2. MT4 documentation is not complete

3. I compiled this code without errors

 

BR 

Fernando Carreiro
1571
Fernando Carreiro 2016.09.19 09:23  
Wennington1: 2, MT4 documentation is not complete

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.

JC
1395
JC 2016.09.19 10:04  
Wennington1:

3. I compiled this code without errors

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.

Fernando Carreiro
1571
Fernando Carreiro 2016.09.19 10:38  
jjc:

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!

JC
1395
JC 2016.09.19 11:43  
FMIC:

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. 

whroeder1
13653
whroeder1 2016.09.19 12:41  
jjc: Like I said, it's then reasonable to question whether the auto-complete is wrong, or whether the documentation is wrong. 
The auto-complete is wrong because it's the same compiler as mql5
JC
1395
JC 2016.09.19 13:05  
WHRoeder:
The auto-complete is wrong because it's the same compiler as mql5

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