| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Memory Usage in EA's https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=913 |
Page 1 of 1 |
| Author: | falsedave [ Sun Oct 28, 2012 8:25 pm ] |
| Post subject: | Memory Usage in EA's |
When writing EA's what are some good practices to have to keep memory usage low ? Is it better for memory usage to use one two dimensional array or say 10 seperate one dimensional arrays ? I have also read somewhere that using icustom to call custom indicators can use a large chunk of memory. What other things should I be aware of ? Dave |
|
| Author: | garyfritz [ Mon Oct 29, 2012 1:22 am ] |
| Post subject: | Re: Memory Usage in EA's |
One 5x10 array should be very little difference compared to 5 1x10 arrays. Calling indicators with iCustom probably eats memory, but in particular it is veeerrry sloooww. Every time you call iCustom, (I believe) it has to load up the indicator, run the indicator code, extract the values you wanted, and unload the indicator. Very inefficient. It's handy to test something quickly, but if you intend to keep it in your EA, see about extracting the relevant code from the indicator and inserting it in your EA. |
|
| Author: | dietcoke [ Mon Oct 29, 2012 6:11 am ] |
| Post subject: | Re: Memory Usage in EA's |
From what I've experienced, memory is less of a problem than CPU. If you take a look at Forex robot and multibob, the two multipair traders I follow, for example, these bots make extensive use of arrays but both perform quite well. When programming EA's and indicators you should alays be looking to avoid repeat calculations on large price data arrays. This is why iCustom can slow things down so much as the icustom call operates on the whole price array when in reality an EA only needs a result from the last data point. It's almost always better if possible to code an indicator within your EA as a function if at all possible. The second thing to try and avoid is making calculations which don't need to be made on every single pass of the EA.Mostly this is avoided by executing these at the start of a new bar. For example, if you want to draw a line on the chart from the start of the current day to current bar, it makes no sense to continuously draw this line. Better to wait for start of a new bar and then extend the line. |
|
| Author: | falsedave [ Mon Oct 29, 2012 9:51 am ] |
| Post subject: | Re: Memory Usage in EA's |
I suppose also by not using iCustom, you dont have to rely on the end user having a copy of the indicator. Which should make everything a little less complicated. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|