Custom symbols. Errors, bugs, questions, suggestions. - page 13

 
fxsaber:

Furthermore, if it is 00:00:01, you cannot use CustomTicksAdd to reshape a bar that was just two seconds ago.

Of course you can't. Because the tick that arrived at 00:00:01 should already form the next bar. In a normal situation.

 
Slava:

For the tester, the tick of the day before yesterday is the fresh tick of today.

I see your point. Your exercises with custom tics from six months ago are of a distinctly tester nature. Your situation is not normal (in the sense of common practice)

As for the non-standard use of custom ones. That's what discussion is for, to identify peculiarities in different situations and try to solve them.

 
Slava:

Of course, this will not work. Because a tick coming in at 00:00:01 should already form the next bar. In a normal situation.

Imagine a Service which timed out the ticks in a second (maybe less, as you usually do on formula ones - 100ms). Then at midnight the bars will often lose the last ticks of the day.

 

Bug 16.

M1 bars are there, but other timeframes are not displayed.


How to reproduce it ironically - don't know.
 
fxsaber:

Bug 16.

M1 bars are there, but other timeframes are not displayed.


I don't know how to reproduce it.
Aren't those bars the ones with non-zero seconds?
 
Slava:
Aren't those bars the ones with non-zero seconds time?

There are real ticks with EURUSD and the bars are normal (multiples of a minute).

The problem was stable on any period other than M1. That's why the video was recorded without any problems.


But after some time the problem stopped playing. The symbol was created by the Expert Advisor from this branch.

 

Bug 17.

The tick story disappears completely.

#define  PRINT(A) Print(#A + " = " + (string)(A))

#define  SIZE 100

void OnStart()
{
  MathSrand((uint)TimeLocal());
  const string Name = _Symbol + (string)MathRand();
  
  MqlTick Ticks[];
  PRINT(CustomSymbolCreate(Name, NULL, _Symbol)); // Создали символ.
  PRINT(SymbolSelect(Name, true)); // Поместили в Обзор рынка
  PRINT(CopyTicksRange(_Symbol, Ticks, COPY_TICKS_INFO, D'2019.06.01' * 1000)); // Взяли тики
  
  PRINT(ArrayResize(Ticks, SIZE));    // Оставили только SIZE-тиков
  PRINT(CustomTicksAdd(Name, Ticks)); // Пробросили их все

  MqlTick NewTicks[];
  PRINT(CopyTicksRange(Name, NewTicks)); // Взяли тики, что в истории
   
//  PRINT(CustomTicksReplace(Name, 0, LONG_MAX, NewTicks)); // И перезаписали их.

  PRINT(CopyTicksRange(Name, Ticks)); // Убедились, что тиков в истории ровно SIZE
  PRINT(CustomTicksDelete(Name, Ticks[SIZE - 1].time_msc - 60 * 1000, LONG_MAX)); // Удалили последнюю минуту
  PRINT(CopyTicksRange(Name, Ticks)); // Убедились, что тиков стало меньше на удаленное количество
}


Result

CustomSymbolCreate(Name,NULL,_Symbol) = true
SymbolSelect(Name,true) = true
CopyTicksRange(_Symbol,Ticks,COPY_TICKS_INFO,D'2019.06.01'*1000) = 533797
ArrayResize(Ticks,100) = 100
CustomTicksAdd(Name,Ticks) = 100
CopyTicksRange(Name,Ticks) = 100
CustomTicksDelete(Name,Ticks[100-1].time_msc-60*1000,LONG_MAX) = 1
CopyTicksRange(Name,Ticks) = 0


If you remove the comment from the underlined line, the script works correctly. Apparently, the old Add-types don't go where the Replace-types go.

 

Bug 18.

When the ticks are removed, the last bar is lost.

#define  PRINT(A) Print(#A + " = " + (string)(A))

void OnStart()
{
  MathSrand((uint)TimeLocal());
  const string Name = _Symbol + (string)MathRand();
  
  MqlTick Ticks[];
  PRINT(CustomSymbolCreate(Name, NULL, _Symbol)); // Создали символ.
  PRINT(SymbolSelect(Name, true)); // Поместили в Обзор рынка
  PRINT(CopyTicks(_Symbol, Ticks)); // Взяли тики
  
  PRINT(CustomTicksReplace(Name, 0, LONG_MAX, Ticks)); // Записали их.
  PRINT(CustomTicksDelete(Name, Ticks[ArraySize(Ticks) - 1].time_msc - 60 * 1000, LONG_MAX)); // Удалили последнюю минуту

  MqlTick LastTick[1];
  PRINT(CopyTicks(Name, LastTick, COPY_TICKS_ALL, 0, 1)); // Распечатали последний тик
  ArrayPrint(LastTick);

  MqlRates LastBar[1];
  PRINT(CopyRates(Name, PERIOD_M1, 0, 1, LastBar)); // Распечатали последний бар
  ArrayPrint(LastBar);
}


Result

CustomSymbolCreate(Name,NULL,_Symbol) = true
SymbolSelect(Name,true) = true
CopyTicks(_Symbol,Ticks) = 2000
CustomTicksReplace(Name,0,LONG_MAX,Ticks) = 2000
CustomTicksDelete(Name,Ticks[ArraySize(Ticks)-1].time_msc-60*1000,LONG_MAX) = 25
CopyTicks(Name,LastTick,COPY_TICKS_ALL,0,1) = 1
                 [time]   [bid]   [ask] [last] [volume]    [time_msc] [flags] [volume_real]
[0] 2019.06.11 22:37:42 1.13284 1.13288 0.0000        0 1560292662809       6       0.00000
CopyRates(Name,PERIOD_M1,0,1,LastBar) = 1
                 [time]  [open]  [high]   [low] [close] [tick_volume] [spread] [real_volume]
[0] 2019.06.11 22:36:00 1.13278 1.13284 1.13278 1.13279            13        3             0
 

Bug 19.

Incorrect calculation of the spread.

#define  PRINT(A) Print(#A + " = " + (string)(A))

void OnStart()
{
  MathSrand((uint)TimeLocal());
  const string Name = _Symbol + (string)MathRand();
  
  PRINT(CustomSymbolCreate(Name, NULL, _Symbol)); // Создали символ.
  PRINT(SymbolSelect(Name, true)); // Поместили в Обзор рынка
  
  MqlTick Tick[1];
  
  if (SymbolInfoTick(_Symbol, Tick[0])) 
  {
    // Специально задаем отрицательный спред.
    Tick[0].bid = 1.11643;
    Tick[0].ask = 1.11632;        
    
    PRINT(CustomTicksAdd(Name, Tick)); // Пробросили тик.
    PRINT(SymbolInfoInteger(Name, SYMBOL_SPREAD)); // Смотрим его спред.
    
    ArrayPrint(Tick); // Смотрим сам тик.
  }
}


Result

CustomSymbolCreate(Name,NULL,_Symbol) = true
SymbolSelect(Name,true) = true
CustomTicksAdd(Name,Tick) = 1
SymbolInfoInteger(Name,SYMBOL_SPREAD) = -10
                 [time]   [bid]   [ask] [last] [volume]    [time_msc] [flags] [volume_real]
[0] 2019.06.03 00:32:11 1.11643 1.11632 0.0000        0 1559521931040       6       0.00000
 

Bug 20. removed from the bugs. Solution found in the branch below.

2085
Incorrect setting of custom symbol properties.
A shift in the result is observed.
Properties were set according to one of the options

CustomSymbolSetInteger(SName, SYMBOL_FILLING_MODE, ORDER_FILLING_FOK);     Результат: Filling == None
или
CustomSymbolSetInteger(SName, SYMBOL_FILLING_MODE, ORDER_FILLING_IOC);     Результат: Filling == Fill or Kill
или
CustomSymbolSetInteger(SName, SYMBOL_FILLING_MODE, ORDER_FILLING_RETURN);  Результат: Filling == Immediate or Cancel


Reason: