Errors, bugs, questions - page 1801

 
Dennis Kirichenko:
It is simply immoral to make a complaint about demo servers, especially ones that are not backed by a broker :-)
If everything works like that on the demo, then it would be immoral to demand normal work from the real servers.

And MQ server should be a kind of "benchmark", on which algo-developers could and should test their technologies.
 
fxsaber:
Multiple SymbolSelect calls will cause the terminal to hang.
bool SymbolExist( const string Symb, const bool MarketWatch = true )
{
  bool Res = false;
  
  for (int i = SymbolsTotal(MarketWatch) - 1; (i >= 0) && (!Res); i--)
    Res = (Symb == SymbolName(i, MarketWatch));
    
  return(Res);
}

bool SymbolOnOff( const string Symb )
{
  return(SymbolSelect(Symb, !SymbolExist(Symb)));
}

void OnStart()
{
  for (int i = SymbolsTotal(false) - 1; i >= 0; i--)
  {
    const string Symb = SymbolName(i, false);
    
    if (SymbolOnOff(Symb))
      SymbolOnOff(Symb);
  }
}
 
I did not see any mention in the Help that if a symbol is not in the Market Watch, no data can be retrieved for it. I had to do it by trial and error.
 
fxsaber:
I did not see any mention in the Help, that if a symbol is not in the Market Watch, then there is no data on it. Had to do it by handwriting.
Right. There is a mention of

Returned value

Value of double type. In case of an unsuccessful execution the error information can be obtained with GetLastError():

  • 5040 - Incorrect string parameter for specifying a symbol name,
  • 4301 - unknown symbol (financial instrument),
  • 4302 - symbol not selected in "Market Watch" (not in list of available),
  • 4303 - wrong symbol property identifier.
 
Slawa:
Right. There's a mention of

Thank you, indirectly mentioned.

Tell me, if I add a symbol to Market Watch via SymbolSelect, how do I know that Bid/Ask by symbol has become available -SymbolIsSynchronized?

SymbolIsSynchronized - seems to be expensive for this purpose, because it also raises the issue of M1-history synchronization.

SymbolIsSynchronized never becomes true on some characters.

 
fxsaber:

Thank you, indirectly mentioned.

Tell me, if I add a symbol to Market Watch via SymbolSelect, how do I know that Bid/Ask by symbol has become available - SymbolIsSynchronized?

SymbolIsSynchronized - seems to be expensive for this purpose, because it also raises the issue of M1-history synchronization.

SymbolIsSynchronized never becomes true on some symbols.

It does, it just takes an excruciatingly long time to load history....
 
Probably a lot of people know, but only now have I guessed to include _LastError in the tracked values when debugging. Recommended.
 
Before checking the history sync flag, you must first call CopyRates(Symbol(),PERIOD_M1,0,1000,rates)

If this is done from the indicator, it will give exactly what is there, but with a request to the history centre for paging. Then it can be excruciating.

If it is done from Expert Advisor or script, then several cycles of requests can be made inside the function with waiting for response, and as a rule after such call history will be synchronized
 
fxsaber:

If I add a symbol to Market Watch via SymbolSelect, how do I know if Bid/Ask on the symbol is available?

Immediately after SymbolSelect(true), I ask for prices and they are zero. At the same time _LastError == 0, SymbolInfoTick == true.

How do I know that prices for the new symbol for Marketwatch have been delivered to Marketwatch?

 
Slawa:
Before checking the history sync flag, you must first call CopyRates(Symbol(),PERIOD_M1,0,1000,rates)

If this is done from the indicator, it will give exactly what is there, but with a request to the history centre for paging. Then it can be excruciating.

If it's done from an EA or a script, then several request cycles can be made inside the function waiting for the answer and, as a rule, the history will be synchronized after such a call
Are you suggesting to do this on every tick?
Reason: