Download MetaTrader 5

Offline chart, EA function

To add comments, please log in or register
Nathan Moss
702
Nathan Moss  

Hi, 2 questions: 

1) Can an EA successfully run on an offline chart? and

2) What is the code snippet to disable or turn off chart (Offline chart) after the 1st tick of a new candle received and then
re-enable this same chart after a new candle on chart has been opened (the next candle) or to turn the chart back on tick
if order was placed on the same offline chart. The exception rule is, if an order was opened or exists on the chart, then do not turn
chart offline and let EA run on chart.

I have 3 solutions already but none of them work 100%, hopefully someone can share their knowledge on the above. 

 Thanks 

Fernando Carreiro
2877
Fernando Carreiro  
Nathan Moss:

Hi, 2 questions: 

1) Can an EA successfully run on an offline chart? and

2) What is the code snippet to disable or turn off chart (Offline chart) after the 1st tick of a new candle received and then
re-enable this same chart after a new candle on chart has been opened (the next candle) or to turn the chart back on tick
if order was placed on the same offline chart. The exception rule is, if an order was opened or exists on the chart, then do not turn
chart offline and let EA run on chart.

I have 3 solutions already but none of them work 100%, hopefully someone can share their knowledge on the above. 

 Thanks 

  1. Yes, but only on MetaTrader v4 as v5 does not have Offline charts (yet).
  2. An EA running on an Offline Chart works in exactly the same way as on a normal chart, so you you would use the usual "time" technique to identify a new candle/bar instead of reacting on each tick.
  3. However, the generator of the Offline Chart has to send "tick" events to the Offline chart in order to keep it active and for the EA to work properly (See my Spread Tracker indicator for an example of how that is done).
whroeder1
15917
whroeder1  
  1. Yes
  2. The offline chart generator.
  3. Online charts don't turn off. Offline charts shouldn't either. It's the EA that handles when to open.
Nathan Moss
702
Nathan Moss  
Fernando Carreiro:
  1. Yes, but only on MetaTrader v4 as v5 does not have Offline charts (yet).
  2. An EA running on an Offline Chart works in exactly the same way as on a normal chart, so you you would use the usual "time" technique to identify a new candle/bar instead of reacting on each tick.
  3. However, the generator of the Offline Chart has to send "tick" events to the Offline chart in order to keep it active and for the EA to work properly (See my Spread Tracker indicator for an example of how that is done).
Hi Fernando, thanks for information. I was not aware Mt5 has not this function yet. Luckily the use of this function will be on Mt4. Thanks also for your Spread Tracker Link. I will see it now
Nathan Moss
702
Nathan Moss  
whroeder1:
  1. Yes
  2. The offline chart generator.
  3. Online charts don't turn off. Offline charts shouldn't either. It's the EA that handles when to open.
Thanks for the information :) appreciated
To add comments, please log in or register