Run script without attach to any chart?

To add comments, please log in or register
Geri_
10
Geri_  

Hi, just want to create a script that saves quotes of a couple of pairs.

My intuition is that it should not be attached to any chart, should not be even an EA, just a simple Script.

What is the preferred way to do this in MQL4?

Mehrdad Jeddi
27243
Mehrdad Jeddi  
Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
William Roeder
18880
William Roeder  
Geri_: My intuition is that it should not be attached to any chart, should not be even an EA, just a simple Script.
  1. Intuition is wrong. To run code (EA, indicator or script,) it must be attached to a chart. But it is not limited to read only that symbol.

  2. On MT4: Unless the current chart is that specific pair/ TF referenced, you must handle 4066/4073 errors before accessing prices.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4

    The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.

Geri_
10
Geri_  
William Roeder:
  1. Intuition is wrong. To run code (EA, indicator or script,) it must be attached to a chart. But it is not limited to read only that symbol.

  2. On MT4: Unless the current chart is that specific pair/ TF referenced, you must handle 4066/4073 errors before accessing prices.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4

    The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.

👍Thanks for the details! Huge plus for hidden charts / market watch stuff.

To add comments, please log in or register