Run script without attach to any chart?

 

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?

 
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...
 
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.

 
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.

Reason: