Download MetaTrader 5
To add comments, please log in or register
Search in documentation is available via MetaTrader 5. Search and learn!
jeef_1985
61
jeef_1985 2016.04.25 17:51 
what is the best way to make a flag using the ObjectCreate function or buffer I can not seem to distinguish between the two I find indicators with 0 buffer and others with buffers please can any one explain to me tje difference thank you
Fernando Carreiro
1451
Fernando Carreiro 2016.04.25 18:30  

This is my personal opinion, but where possible, I try to do the most I can as "buffers". I use Objects on the chart as a last resort or when there is specific need for them.

I find that having too many objects on the chart can become really messy, both in code (to keep track of them all) and I suspect also with regards to resource usage (RAM & CPU).

It also becomes messy when you save it as a template since all those Chart Objects get saved to the template as well.

The rule I use for myself, is to use only "buffers" in Indicators and Chart Objects only in EA's.

Doerk Hilger
1073
Doerk Hilger 2016.04.25 18:39  

Many objects do not affect the CPU very much, it's only a problem when theyre treated like its done with the MQL5 standard library. I deal with more than 1000 objects on every chart and cannot recognize any performance problems.

The other topic, with the presets, yes, totally agree. I cannot understand why there is no separation between objects created by an EA and such created manually. It makes no sense at all and its a problem in view of security that a user is allowed to modify and delete such objects. 

Fernando Carreiro
1451
Fernando Carreiro 2016.04.25 19:19  
Doerk:

It makes no sense at all and its a problem in view of security that a user is allowed to modify and delete such objects. 

Not entirely true. There is a possibility of some separation that prevents the user from modifying or deleting them:

OBJPROP_HIDDEN:

Prohibit showing of the name of a graphical object in the list of objects from the terminal menu "Charts" - "Objects" - "List of objects". The true value allows to hide an object from the list. By default, true is set to the objects that display calendar events, trading history and to the objects created from MQL4 programs. To see such graphical objects and access their properties, click on the "All" button in the "List of objects" window.

Doerk Hilger
1073
Doerk Hilger 2016.04.25 19:55  
I know that, but as you wrote as well: Click on the "All" .... makes it still unsafe with just one click more. 
Fernando Carreiro
1451
Fernando Carreiro 2016.04.25 20:14  
Doerk:
I know that, but as you wrote as well: Click on the "All" .... makes it still unsafe with just one click more. 

That is why I wrote "Not entirely true" and "possibility of some separation"! It is not ideal, but it helps reduce accidental changes to a degree.

jeef_1985
61
jeef_1985 2016.04.25 20:14  

-- The rule I use for myself, is to use only "buffers" in Indicators and Chart Objects only in EA's. --

this is exactly what I try to do but I just wanted to know the difference between the two methods, I believe that the indicators that require very complex calculations of the formulas must be used buffers while for simple indicator

or representation of objects on the chart I use the function ObjectCreate 

whroeder1
13610
whroeder1 2016.04.25 20:20  
jeef_1985: what is the best way to make a flag using the ObjectCreate function or buffer I can not seem to distinguish between the two I find indicators with 0 buffer and others with buffers please can any one explain to me tje difference thank you
If you use a buffer
If you use objects
You just set the buffer[] and are done.You must use unique names for the objects, set every property every time.
Read the buffer with one iCustom call. Perhaps in a loop to find the last set one.
Must loop through all objects, find names with a specific pattern, find the one with the last time.
Fernando Carreiro
1451
Fernando Carreiro 2016.04.25 20:21  
jeef_1985:

-- The rule I use for myself, is to use only "buffers" in Indicators and Chart Objects only in EA's. --

this is exactly what I try to do but I just wanted to know the difference between the two methods, I believe that the indicators that require very complex calculations of the formulas must be used buffers while for work of indicteur

single or representation of objects on the chart I use the function ObjectCreate 

I recommend to not using Chart Objects if you can, even for simple situations. This does not mean that you cannot use them, just be aware of the limitations, and the possibility of accidental (or deliberate) changes made by the user.

For example, lets say that you are placing "HLines" and you accidentally double click on one and move it. If it were a "buffer" generated solution, you would no longer have to worry about that.

However, there are obviously times one must use Chart Objects and there is no other alternative.

Doerk Hilger
1073
Doerk Hilger 2016.04.25 20:22  

1009 Objects exactly. Performance is really no criteria.

Doerk Hilger
1073
Doerk Hilger 2016.04.25 20:23  
FMIC:


For example, lets say that you are placing "HLines" and you accidentally double click on one and move it. If it were a "buffer" generated solution, you would no longer have to worry about that.


No, you cannot move lines that have been created by the EA if you set the parameters correct.
/ /123
To add comments, please log in or register