Download MetaTrader 5

Feature Request – Access Objects by Index

To add comments, please log in or register
Millions of traders download codes from MQL5 library. Share your app with them!
Anon
32
Anon 2014.06.03 07:13 

Problem – Object Search Time

I refer to my previous post titled Feature Request - Access Global Variables By Index.

There is also a similar search time problem with object functions which use an object name to locate an object on a chart.

EA creates, modifies and deletes a significant number of chart objects which are used for visual display in the one-week testing period.

Searching for a chart object as the number of objects increase requires incrementally more computing search time to locate that object. Testing has shown that as the number of objects increases the time required to locate an object increases exponentially.

Feature Request – Access Objects by Index

If index values are used to locate objects then the time required to access those objects will be substantially reduced.  The time saving for accessing objects by index should be greater than the time saving for accessing global variables by index if there are more objects than global variables.

The above can be implemented, as for the global variable functions, by adding an index implementation to the object functions.

Future Considerations - Improved Objects

Accessing objects by index value should make it computationally practicable to have a large number of concurrent modifiable objects on a chart including pixel objects.  This would enable video to be displayed on charts.

 

 

Alain Verleyen
Moderator
30722
Alain Verleyen 2014.06.03 22:13  
anon:

Problem – Object Search Time

I refer to my previous post titled Feature Request - Access Global Variables By Index.

There is also a similar search time problem with object functions which use an object name to locate an object on a chart.

EA creates, modifies and deletes a significant number of chart objects which are used for visual display in the one-week testing period.

Searching for a chart object as the number of objects increase requires incrementally more computing search time to locate an object. Testing has shown that as the number of objects increases the time required to locate an object increases exponentially.

Where is the test ?

Feature Request – Access Objects by Index

If index values are used to locate objects then the time required to access those objects will be substantially reduced.  The time saving for accessing objects by index should be greater than the time saving for accessing global variables by index if there are more objects than global variables.

The above can be implemented, as for the global variable functions, by adding an index implementation to the object functions.

What prevents you from doing so ?
Anon
32
Anon 2014.06.05 06:48  
See testing results below.

Chart objects in MT can't be accessed by index only by name. That's why the post was written.

Alain Verleyen
Moderator
30722
Alain Verleyen 2014.06.05 12:30  
anon:
See testing results below.

Chart objects in MT can't be accessed by index only by name. That's why the post was written.


  • We can't see the method used to build this graph, so it's without any value.
  • Objects can be accessed by index if you manage the index your self.
  • Is it an academic question or is there any practical usage for more than 10,000 objects ?
Anon
32
Anon 2014.06.06 05:57  
angevoyageur:
  • We can't see the method used to build this graph, so it's without any value.
  • Objects can be accessed by index if you manage the index your self.
  • Is it an academic question or is there any practical usage for more than 10,000 objects ?
The graph represents a sample of 30 tests using the ObjectCreate function.

You still need to get those objects onto the screen and the time taken by MT to do that is where the problem is because of the way it accesses objects (by name rather than by index).

It is practical. Some of the strategies create tens of thousands of objects per chart.

Ian Venner
2584
Ian Venner 2014.06.06 06:15  

Are tens of thousands of objects really relevent to a current trading decision or are most of them historical ? If they are you should delete the old ones to improve access times on the relevent ones.

Anon
32
Anon 2014.06.06 06:29  
Yes, they are as they provide visual cues to what is occurring in the market and decisions to vary some of the strategies are made based on them. Yep, historical ones can be deleted.

EDIT: Note that objects are also used in testing and this is where the access speed of objects becomes a particular problem.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.06.06 06:38  
So basically you want to see where the market moves from certain index and up to the latest. I see.
whroeder1
14480
whroeder1 2014.06.06 10:00  
You don't need to access the objects but once on init. Capture the values that you need in an array and use that.
Halley
198
Halley 2014.06.06 11:03  

I tried to reproduce the behaviour, because I became a bit confused about mixing the access (i.e. search) and "creation" (with the chart comment) . Fortunately I did not need to know a "method", because I can write a few lines myself.

The results are pretty interesting. The most interesting is the final time for the built-in ObjectDeleteAll():

 

12:45:16 Script speedTest EURUSD,M10: loaded successfully
12:45:18 speedTest EURUSD,M10 inputs: count=10000; 
12:45:18 speedTest EURUSD,M10: initialized
12:45:18 speedTest EURUSD,M10: create time = 78
12:45:18 speedTest EURUSD,M10: search time = 16
12:45:18 speedTest EURUSD,M10: delete time = 47
12:45:18 speedTest EURUSD,M10: uninit reason 0
12:45:18 Script speedTest EURUSD,M10: removed
12:45:30 Script speedTest EURUSD,M10: loaded successfully
12:45:37 speedTest EURUSD,M10 inputs: count=100000; 
12:45:37 speedTest EURUSD,M10: initialized
12:45:38 speedTest EURUSD,M10: create time = 920
12:45:38 speedTest EURUSD,M10: search time = 93
12:45:43 speedTest EURUSD,M10: delete time = 4805
12:45:43 speedTest EURUSD,M10: uninit reason 0
12:45:43 Script speedTest EURUSD,M10: removed
12:46:09 Script speedTest EURUSD,M10: loaded successfully
12:46:16 speedTest EURUSD,M10 inputs: count=200000; 
12:46:16 speedTest EURUSD,M10: initialized
12:46:27 speedTest EURUSD,M10: create time = 11153
12:46:27 speedTest EURUSD,M10: search time = 202
12:46:58 speedTest EURUSD,M10: delete time = 30592
12:46:58 speedTest EURUSD,M10: uninit reason 0
12:46:58 Script speedTest EURUSD,M10: removed
Alain Verleyen
Moderator
30722
Alain Verleyen 2014.06.06 23:10  
anon:
Yes, they are as they provide visual cues to what is occurring in the market and decisions to vary some of the strategies are made based on them. Yep, historical ones can be deleted.

EDIT: Note that objects are also used in testing and this is where the access speed of objects becomes a particular problem.

If you think it's something important not only for you, you can make the suggestion to Metaquotes by writing to the Service Desk.

But you can be sure you need more solid arguments than what you posted here.

12
To add comments, please log in or register