Download MetaTrader 5
To add comments, please log in or register
Post web links to other trader's signals and make profit
rod178
276
rod178 2014.08.17 05:53 

I am currently investigating the best approach to minimize/eliminate terminal ‘freeze-ups’ during periods of high volatility. My assumption is that during these periods my MT4 instance is reacting to new ticks before it has finished recalculating Indicators, hence the ‘freeze-ups’, which can last from one to several seconds. eg cross hairs tool freezes, cannot place orders, move stops  etc etc.

The system spec s are –

i5 3540  (4 core)      8GB DDR3 16MHz RAM            System Disk  SSD         ADSL about 16mbps

I have a requirement to  send time an price information, produced by process intensive indicators, to EA(s) that perform pattern recognition function on price levels in predetermined  timezones.   The EAs and Indicators are currently running on the Major pairs separate charts. The ‘freeze-ups’  seems to make my current approach, of all Indicators and EAs being replicated across all the Major pairs on the same MT4 instance, not a viable approach.

I would appreciate any suggestions  as to revising my approach to facilitate minimizing the occurrence of terminal ‘freeze-ups’.

My thoughts so far are –

    1) Convert some Indicators to Scripts on the first MT4 instance.

    2)  Reduce(d) max bars in Chart to the minimum.

    3)  Run a second MT4 instance on one PC.  The first Instance to generate signals off multiple  process intensive Indicators on multiple charts  and write multiple price and time data to File.  The second instance to run one pattern recognition EA on all Major pairs on one chart. Upon a pattern being identified, on a specific pair, the EA reads the Time and Price File(s) for the specific pair and places an Oder if the criterial are met.

    4)  As above except, the second instance to run separate pattern recognition EAs on each Major pairs on separate charts. Upon a pattern being identified, on a specific pair, the EA reads the Time and Price File(s) for the specific pair and places an Order if the criterial are met.

    5)  As above except use a Messaging App to communicate between the two instances.

   6)   As above except the second MT4 instance is run on a second PC. My assumption is that this will not provide any added benefit to running on a single 4 core PC.

 

Additional Questions:

   a)  do large numbers of Indicators and Scripts impact on performance subsequent first compilation, even when not active on any charts?

   b)  Does each MT4 instance run on a separate core?

   c)  Can separate MT4 instances be run off the same broker feed without , a performance impact?

   d)  Can max bars in Chart be reduced from 5000? I only require 1000 for the second instance.

Michele Lazzarini
470
Michele Lazzarini 2014.08.17 07:55  

The idea to reduce the max bars is surely good :) The less you use the better performances.

Hou many indicators are you running? Try to check separately how they impact performances.

Do you see any slowdown at the time you add an indicator? (You could use this to test their "weight" on cpu)


Period you need / Timeframe to use = Needed bars

(1 week = 5 days)

honest_knave
958
honest_knave 2014.08.17 09:07  

I'd be looking to optimize the existing code first, before exploring any complicated workarounds.

The latest builds have added plenty of new features, some of which may be able to improve your code's efficiency.

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.08.17 10:06  
honest_knave:

I'd be looking to optimize the existing code first, before exploring any complicated workarounds.

Indeed, for example checking that indicators/EAs do noy do things on each tick that they only need to do once per bar,  and don't do things once per bar that they only need to do less frequently than once per bar . . .  also make sure Indicators are no recalculating for all bars unnecessarily.

Simple optimization can often bring huge gains . . .  https://www.mql5.com/en/forum/144240/page2#779752 

rod178
276
rod178 2014.08.17 10:22  
RaptorUK:

Indeed, for example checking that indicators/EAs do noy do things on each tick that they only need to do once per bar,  and don't do things once per bar that they only need to do less frequently than once per bar . . .  also make sure Indicators are no recalculating for all bars unnecessarily.

Simple optimization can often bring huge gains . . .  https://www.mql5.com/en/forum/144240/page2#779752 


Thanks for the responses. Updating the Indicators once per Bar seems  worth investigating further, for those Indicators that I cannot convert to Scripts.

 Would running one EA on one Chart for multiple pairs reduce lag, rather than  separate EAs on multiple separate charts for each pair?

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.08.17 10:52  
rod178:


Thanks for the responses. Updating the Indicators once per Bar seems  worth investigating further, for those Indicators that I cannot convert to Scripts.

 Would running one EA on one Chart for multiple pairs reduce lag, rather than  separate EAs on multiple separate charts for each pair?

I don't think one EA working on multiple pairs on one chart  vs  multiple EAs one per chart is going to make much performance difference . . . but it will give you issues to deal with . . .  a tick on EURUSD does not mean a tick has happened on GBPUSD so you will have to ensure you are not working with out of date prices.
Halley
198
Halley 2014.08.17 11:28  

If the terminal rather freezes than slows down, then the indicators are the burden, not EA or script.

BTW, are there any offline charts running in your terminal? They require modified indicators to avoid power drain.

rod178
276
rod178 2014.08.17 13:17  
DeepThought:

If the terminal rather freezes than slows down, then the indicators are the burden, not EA or script.

BTW, are there any offline charts running in your terminal? They require modified indicators to avoid power drain.

No, I do not use offline charts on the live trading platform, so not the issue.

Yes, it is (I suspect) the Indicators, hence the reason I'm slowly converting  most of my Custom Indicators to Scripts.. It is a freeze issue, not a slowing down, however only during short periods of high volatility eg FOMC, NFO etc.

A friend with the same broker feed does not have the issue. His charts are basically naked, so the issue is (I suspect) with my setup.

One option that I may investigate is auto removal of all indicators, via Temples, during the potential trading timezone (eg around LO and NYO). I already have the code to autoswitch templates.

Thanks all for their comment. If anyone has any information on Questions (a) to (d) that would help. My aim is to make my setup, during trading Timezone, as lite as possible. eg reducing max bars in Chart to about 1000, although I do not know if that is possible. The minimum seems to be 5000.

 

EDIT: these articles on 'ways of detecting new bars' may hold some answers to optimization  

https://www.mql5.com/en/articles/159

https://www.mql5.com/en/articles/109

https://www.mql5.com/en/articles/22#check_new_bar

https://www.mql5.com/en/code/107 

/
To add comments, please log in or register