[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 244

 
Good afternoon everyone. I have this question: I want to make the EA request data from other currency pairs and timeframes. To do this, I have to keep several dozens of charts open (although the EA is installed on only one chart). All this "eats" a lot of memory and slows down the VPS (even if the settings reduce the number of bars in the history/window). Is there any way to solve the problem without opening a lot of charts, but for the required timeseries to continue to exist? Thank you in advance for your reply.
 
AndEv:
Good day to all. I have a question: I want to make my EA to request data from other currencies and timeframes. To do this, I have to keep several dozen open charts (although my Expert Advisor is only on one chart). All this "eats" a lot of memory and slows down the VPS (even if the settings reduce the number of bars in the history/window). Is there any way to avoid opening a lot of charts, but for the required timeseries to continue to exist? Thank you in advance for your reply.

What exactly do you need from other currencies? For example, you can specify any currencies and timeframes in the indicators and get the data that way.

double iMA(NULL, 0, ...) // по символу и таймфрейму текущего графика
double iMA("AUDUSD", PERIOD_W1, ...) // по AUDUSD и по недельному таймфрейму

And you do not need to keep the AUDUSD, W1 chart open.

 
paladin80:

What exactly do you need from other currencies? For example, you can specify any currencies and timeframes in the indicators and get the data that way.

And you do not need to keep the AUDUSD, W1 chart open.

Any indicator performs its calculations based on the time series (in your example "AUDUSD", PERIOD_W1), and the time series does not exist without a chart. The question is whether there is any way around this. In MT4 you couldn't do many things, but competent people (Zhunko, for example) have made many things possible. I tried to get the data as you say, but it didn't work, although the pair was present in the Market Watch window. After opening the relevant chart I was able to get the necessary data immediately.
 
AndEv:
Any indicator makes its calculations based on a timeseries (in your example "AUDUSD", PERIOD_W1), and a timeseries does not exist without a chart. The question is whether there is any way around this. In MT4 you couldn't do many things, but competent people (Zhunko, for example) have made many things possible. I tried to get the data as you say, but it didn't work, although the pair was present in the Market Watch window. After opening the relevant chart it was immediately possible to get the necessary data.

A timeseries exists without a chart, if the instrument is of course open and there is a constant reference to this timeframe. In this case a chart is not needed at all
 
AndEv:
Any indicator performs its calculations based on the time series (in your example "AUDUSD", PERIOD_W1), but the time series does not exist without a chart. The question is whether there is any way around this. In MT4 you couldn't do many things, but competent people (Zhunko, for example) have made many things possible. I tried to get the data as you say, but it didn't work, although the pair was present in the Market Watch window. After opening the relevant chart I managed to get the necessary data right away.
Made a code like this:

double MA_AUDUSD_M5, MA_AUDUSD_W1, MA_EURCAD_H1;
//+------------------------------------------------------------------+
int start()
  {
//----
MA_AUDUSD_M5=iMA("AUDUSD",PERIOD_M5,20,0,MODE_SMA,PRICE_CLOSE,0);
MA_AUDUSD_W1=iMA("AUDUSD",PERIOD_W1,20,0,MODE_SMA,PRICE_CLOSE,0);
MA_EURCAD_H1=iMA("EURCAD",PERIOD_H1,20,0,MODE_SMA,PRICE_CLOSE,0);

Comment ("MA_AUDUSD_M5 = ",DoubleToStr(MA_AUDUSD_M5,Digits),"\n",
         "MA_AUDUSD_W1 = ",DoubleToStr(MA_AUDUSD_W1,Digits),"\n",
         "MA_EURCAD_H1 = ",DoubleToStr(MA_EURCAD_H1,Digits));
//----
   return(0);
  }
//+------------------------------------------------------------------+
int init()
  {
   return(0);
  }
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+

When testing with visualisation on EURUSD, Daily turns out like this:


There was really something wrong with EURCAD. I remembered that I don't work with this instrument and maybe there is no history for it, I downloaded (F2, etc.), restarted the terminal and this is what I got:


There is data on EURCAD. Maybe, I should tell VPS the history for the required instrument.

 
AndEv:
Any indicator makes its calculations based on a timeseries (in your example "AUDUSD", PERIOD_W1), and a timeseries does not exist without a chart. The question is whether there is any way around this. In MT4 you couldn't do many things, but competent people (Zhunko, for example) have made many things possible. I tried to get the data as you say, but it didn't work, although the pair was present in the Market Watch window. After opening the relevant chart it was immediately possible to get the necessary data.

Preventively ask for data for the required instrument, it is built without a chart, but it takes time.
 
FAQ:

Preventively request the data for the desired instrument, it is built up without a graph, but it takes time.
That's the point, it's possible to get the data when you ask for it again. But how do you make it happen the first time?
 
hoz:

And here is actually the turkey itself.

https://www.mql5.com/ru/code

I am not interested in the indicator itself as a trading signal. But I noticed the interesting name and decided to see its "guts". So I stumbled across...

I decided to bring it to "usual" look (forgive me the author). What I got (in the file).
Files:
ssl.mq4  4 kb
 
AndEv:
That's the point, it's possible to get the data when you ask for it again. But how do you make it work the first time?

Have you tried error handling?
 
paladin80:

Maybe the VPS should tell the stories on the tools being trumpeted.

Downloading the history won't do anything, as the query needs fresh data all the time. I also did such a script, and then I moved the code to the owls, so that the launch is done from the incoming tick. In dynamics withoutopening chart I have to query twice, only in this case I can get fresh data. I don't know how to do it without repeated query.
Reason: