Errors, bugs, questions - page 2409

 
Dear developers! Are you going to fix the site? Every time I go in there is a notification about a product update. I look at this alert and it comes up again. It shouldn't be like this!
 
Alexey Kozitsyn:
Dear developers! Are you going to fix the site? Every time I come in - a notification of product update. I look through this alert and it occurs again. It shouldn't be like this!


I don't have this kind of error by product.

There is a general error of not reading messages.

The error occurs when several tabs are open, until you close them, they will not be read.

There is one more thing - you have to go to this message twice - then it will be marked as read.

This may help developers.

 

The indicator chart is missing (indicator for futures contracts, if not BR-4.19, then input int NextFutMonth = 3; //Futures NextFutMonth (month))

//+------------------------------------------------------------------+
//|                                                   BR_Scalper.mq5 |
//|                                      Copyright 2019 prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019 prostotrader"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1

//--- plot Label1
#property indicator_label1  "Spread"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrYellow
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

//#property indicator_maximum 30
//#property indicator_minimum -30

#define  on_call -111
//
input int NextFutMonth = 1;    //След фьючерс (мес.)
input int aBars = 30;          //Бары  
//
double Buff[];
double pr_last, sec_last;
string sec_symbol;
bool pr_book, sec_book;
int event_cnt;

//+------------------------------------------------------------------+
//| Indicator Set second Symbols function                            |
//+------------------------------------------------------------------+
string SetSecSymbol(const string aSymbol)
{
  int str_tire = StringFind(aSymbol, "-");
  int str_tochka = StringFind(aSymbol, ".", str_tire);
  int str_size = StringLen(aSymbol);
  if((str_tire > 0) && (str_tochka > 0) && (str_size > 0))
  {
    string str_month = StringSubstr(aSymbol, str_tire + 1, str_tochka - str_tire - 1);
    string str_year = StringSubstr(aSymbol, str_tochka + 1, str_size - str_tochka - 1);
    long aMonth = StringToInteger(str_month);
    long aYear = StringToInteger(str_year);
    if((aMonth > 0) && (aYear > 0))
    {
      long n_month = aMonth + long(NextFutMonth);
      long add_year = (n_month - 1) / 12;
      aYear += add_year;
      str_year = IntegerToString(aYear); 
      aMonth = n_month - add_year * 12;
      str_month = IntegerToString(aMonth);
      return(StringSubstr(aSymbol, 0, str_tire + 1) + str_month + "." + str_year);
    } 
  }
  return("");
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
  int a_bars = Bars(Symbol(), PERIOD_CURRENT);
  if(a_bars < aBars + 1)
  {
    Alert("На графике не хватает баров!");
    return(INIT_FAILED);
  } 
  event_cnt = 0;
  sec_symbol = SetSecSymbol(Symbol());
  if(SymbolSelect(sec_symbol, true) == false) return(INIT_FAILED);
  pr_book = MarketBookAdd(Symbol());
  sec_book = MarketBookAdd(sec_symbol);
  IndicatorSetInteger(INDICATOR_DIGITS, 0);
  IndicatorSetString(INDICATOR_SHORTNAME, "BR_Scalper");
//---  
  SetIndexBuffer(0, Buff, INDICATOR_DATA);
  PlotIndexSetDouble( 0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
  ArraySetAsSeries(Buff, true );
  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
// Custom indicator DeInit function                                  |
//+------------------------------------------------------------------+
void OnDeinit( const int reason )
{
  if(pr_book == true) MarketBookRelease(Symbol());
  if(sec_book == true) MarketBookRelease(sec_symbol);
  if(reason == REASON_INITFAILED)
  {
    Print("Индикатор удалён! Причина - ошибка инициализации.");
    string short_name = ChartIndicatorName(ChartID(), 1, 0);
    ChartIndicatorDelete(ChartID(), 1, short_name); 
  }
}
//+------------------------------------------------------------------+
// Custom indicator On book event function                           |
//+------------------------------------------------------------------+
void OnBookEvent( const string& symbol )
{
  if((symbol == Symbol()) || (symbol == sec_symbol))
  {
    sec_last = SymbolInfoDouble(sec_symbol, SYMBOL_LAST);
    pr_last = SymbolInfoDouble(Symbol(), SYMBOL_LAST);
    double price[]; 
    OnCalculate( event_cnt, event_cnt, on_call, price ); 
  }
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
{
  if(prev_calculated == 0)
  {
    ArrayInitialize(Buff, EMPTY_VALUE);
  }
  else
  {
    if(begin == on_call)
    {
      for(int i = aBars - 1; i > 0; i--)
      {
        Buff[i] = Buff[i - 1];
      }
    }
    else
    {
     sec_last = SymbolInfoDouble(sec_symbol, SYMBOL_LAST);
     pr_last = SymbolInfoDouble(Symbol(), SYMBOL_LAST); 
     Buff[aBars] = EMPTY_VALUE;
    } 
    Buff[0] = (sec_last - pr_last) /Point();
  } 
//---    
  event_cnt = rates_total;  
//--- return value of prev_calculated for next call
  return(rates_total);
}
//+------------------------------------------------------------------+

But when you put

#property indicator_maximum 30
#property indicator_minimum -30

it works fine

 

The tester closes trades using quotes of another instrument.


1. opening eurusd price 1.30935.

2. Closing price 1.60704. There was no such a price, but there was such a price for another instrument gbpusd at that time.





Testing is performed for two symbols eurusd and gbpusd. If gbpusd is excluded, the error disappears.


 
Aleksey Sergan:

The tester closes trades using quotes of another instrument.


1. opening eurusd price 1.30935.

2. Closing price 1.60704. It was not such a price, but it was at that time for another symbol gbpusd.





Testing is performed for two symbols eurusd and gbpusd. If gbpusd is excluded, the error disappears.


Where is the code of this miracle adviser? I give 99% that you are working with classes and use a static variable somewhere.

 
Vladimir Karputov:

Where is the code for this miracle adviser? 99% bet you work with classes and use a static variable somewhere.

Vladimir, are you joking?

 
Andrey Barinov:

Vladimir, are you kidding?

I am still waiting for an answer fromAleksey Sergan. Depending on the answer there will be a second leading part of the question.

 
Vladimir Karputov:

I am still waiting for an answer fromAleksey Sergan. Depending on the answer there will be a second leading part of the question.

I see. So you're not kidding after all...

Sometimes a terminal bug is just a terminal bug.
 
Vladimir Karputov:

Where is the code for this miracle adviser? 99% bet you work with classes and use a static variable somewhere.

The code is several thousand lines. There is no point in attaching it. There are no static variables. There are classes. Either way it's a tester error.

 
Andrey Barinov:

I get it. So you're not kidding after all...

Sometimes a terminal bug is just a terminal bug.

Nuh-uh :)

Reason: