Errors, bugs, questions - page 1803

 
Slawa:
Or, as just said here, ask for the number of bars, also a few cycles.
If there is a call of the Bars() function after a long idle time, starting of the indicator - is it akin to checking SymbolIsSynchronized()?
 
Slawa:
This also applies to indicators. Create a 1-minute timer and ask for the number of bars of all timeseries of interest.

Checking the timing fact does not hold the timing.
It would be good to add this to the documentation...
 
If you leave only MOEX symbols in the Market Watch on Metaquotes-Demo, TimeCurrent will lag by 15 minutes. As soon as a single FOREX symbol is added, TimeCurrent jumps ahead by 15 minutes at once.
 

Dear developers! Once again I ask to add time in ms for sentiment values(SYMBOL_SESSION_...) and tumbler( OnBookEvent()) as soon as possible. Give a chance to make synchronization of all available data!

 

Metaquotes-Demo, symbol DIG-20170330

SymbolInfoDouble(Symb,::SYMBOL_ASK) = 29006.0
SymbolInfoDouble(Symb,SYMBOL_SESSION_PRICE_LIMIT_MIN) = 29528.0
(ENUM_SYMBOL_TRADE_MODE)SymbolInfoInteger(Symb,SYMBOL_TRADE_MODE) = SYMBOL_TRADE_MODE_FULL (4)

Error in SYMBOL_SESSION_PRICE_LIMIT_MIN: above Ask - no BuyLimit can be set.

 
fxsaber:

Please share your bike: a bool function that tells you whether a symbol is ready to trade or not.

ENUM_DAY_OF_WEEK GetDayOfWeek( const datetime time )
{
  MqlDateTime sTime = {0};

  TimeToStruct(time, sTime);
  
  return((ENUM_DAY_OF_WEEK)sTime.day_of_week);
}

// true - находимся в торговой сессии
bool SessionTrade( string Symb = NULL )
{  
  datetime TimeNow = TimeTradeServer();
  
  const ENUM_DAY_OF_WEEK DayOfWeek = GetDayOfWeek(TimeNow);
  
  TimeNow %= 24 * 60 * 60;
  
  if ((Symb == NULL) || (Symb == ""))
    Symb = Symbol();  
  
  bool Res = false;
  datetime From, To;    

  for (int i = 0; SymbolInfoSessionTrade(Symb, DayOfWeek, i, From, To) && (!Res); i++)
    Res = ((From <= TimeNow) && (TimeNow < To));
    
  return(Res);
}

// Возвращает true, если символ торгуемый. Иначе - false.
bool SymbolTrade( string Symb = NULL, const int Pause = -1 )
{
  MqlTick Tick;
  
  if ((Symb == NULL) || (Symb == ""))
    Symb = Symbol();
    
  if (Pause >= 0)
    Sleep(Pause); // Если только что произошло добавление символа в Обзор рынка, нужно дождаться поступления данных в Marketwatch.
  
  return(SymbolInfoTick(Symb, Tick) ? ((Tick.bid != 0) && (Tick.ask != 0) && SessionTrade(Symb) &&
         ((ENUM_SYMBOL_TRADE_MODE)SymbolInfoInteger(Symb, SYMBOL_TRADE_MODE) == SYMBOL_TRADE_MODE_FULL)) : false);
}
 
fxsaber:
   
  if (Pause >= 0)
    Sleep(Pause); // Если только что произошло добавление символа в Обзор рынка, нужно дождаться поступления данных в Marketwatch.
   
What if it's in an indicator?
 
Artyom Trishkin:
What if it's in an indicator?
Hence the legs

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.02.14 12:31

Immediately after SymbolSelect(true) I request prices and they are zero. With _LastError == 0, SymbolInfoTick == true.

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

So, if SymbolSelect(true) wasn't done, and we didn't set Pause specifically, then there will be no slip.
 
fxsaber:
Hence the legs.
So if SymbolSelect(true) is not done and you don't specifically set Pause, there will be no slip.
Honestly, I don't get it. I was wondering: how do you know if a symbol is ready in an indicator? Sleep() does not work in indicators.
If the indicator plots some statistical data on symbols that are not known beforehand, when you select the next symbol from the panel, you often cannot get the data for it at once, and the table will contain false information... How can I be sure that the data received from the symbol is correct and in sufficient quantities to obtain further correct calculations?
 
Artyom Trishkin:
Honestly, I don't get it. I was wondering: how do you know if a symbol is ready in an indicator? Sleep() does not work in indicators.
If the indicator displays in the table some statistical data on symbols that are not known in advance, then when you select the next symbol from the panel, you often can not immediately get the data for it, and the table displays false information... How can I be sure for further calculations, that the data obtained from the symbol are correct, and in sufficient quantities to obtain further correct calculations?
Sleep is only needed when the symbol is not in the Market Watch. For all symbols that are in the Market Watch before (and during) the start of the indicator, no slips are needed.
Reason: