Errors, bugs, questions - page 2470

 
Igor Zakharov:

So it's not in seconds...

That's what the language description should be about in the first place.

Not in articles that you have to search for. The last thing you should look for on the forum is this.

Otherwise, it turns out: I look in a book, but I see a fig...

 

Why would this be the case?

IM      0       17:19:04.403    Terminal        MetaTrader 5 x64 build 2056 started (MetaQuotes Software Corp.)
NG      0       17:19:04.403    Terminal        Windows 7 Service Pack 1 (build 7601) x64, IE 11, AMD FX-4170 Quad-Core Processor , Memory: 9408 / 12255 Mb, Disk: 20 / 238 Gb, GMT+3

I have found out today that the minimum volume in the tool specification is 100 and the step is also 100. However, it does not open positions with"Invalid volume" error. If I set 0.01, buttons are inactive.

Replaced the version with a "younger" version.

KK      0       17:35:14.046    Terminal        MetaTrader 5 x64 build 2025 started (MetaQuotes Software Corp.)
IE      0       17:35:14.046    Terminal        Windows 7 Service Pack 1 (build 7601) x64, IE 11, AMD FX-4170 Quad-Core Processor , Memory: 9182 / 12255 Mb, Disk: 20 / 238 Gb, GMT+3

no change.

Then replaced it with the release version.

FI      0       17:37:23.049    Terminal        MetaTrader 5 x64 build 2007 started (MetaQuotes Software Corp.)
RS      0       17:37:23.049    Terminal        Windows 7 Service Pack 1 (build 7601) x64, IE 11, AMD FX-4170 Quad-Core Processor , Memory: 9180 / 12255 Mb, Disk: 20 / 238 Gb, GMT+3

And here is the result.



Why is it happening only to one company? If it were widespread, the problem would have been solved long ago.

What direction should I send to the support of the company?


Added: It is very strange that build 2025 build works fine on a cent account of the same company. All tool parameters are as they should be.

You may trade on cent. I figured it out myself... ...but I want more.

 
Ilyas:

Thank you for your message.
It's a rudiment, we'll fix it.

@Ilyas, there is a similar problem with NonPOD struct.

struct NonPod{
   uchar data[];
};   
   
void OnStart(){
   NonPod obj;
   
   obj = (NonPod)(obj);   // '(' - invalid cast operation	
}
 
Does anyone know how, apart from waiting for a new build with namespace support for classes, to get around this limitation:
template<typename T>
class TestTypedef{
public:
   typedef void (* callback)(T &);    // 'callback' - identifier already used
   callback eq;
};


void ff(int&) {Print(__FUNCSIG__);}

void OnStart(){  

   TestTypedef<int> int_value;
   int_value.eq = ff;
   
   int x = 5;
   int_value.eq(x);                 // Ok

   TestTypedef<string> int_value;   //Compile error 'callback' - identifier already used
}

Problem in global namespace declaration area withintypedef functionality

 
MT5 (build 2057)

Compilation error on repeated use of the same function signature within typedef:
typedef void (* callback_0)();     // а без этой строки все ОК
typedef void (* callback)();

void test_func(){}

void OnStart(){
   callback func_ptr = test_func;  //'test_func' - type mismatch
   func_ptr();
}
 
Sergey Dzyublik:
MT5 (build 2057)

Bug with "prohibition" to reuse the same signature within typedef:

And I havean essentially similarscript from over 2 years ago giving a 2056x32 result: EX5 loading failed

 
Sergey Dzyublik:
Does anyone know how, apart from waiting for a new build with namespace support for classes, to bypass this restriction:

Compile

void f(int&) {}
void OnStart()
{
   TestTypedef<int> int_value;
   TestTypedef<string> string_value;

it is possible (and will even work), but no more than that: then, let's say, you cannot write

   int_value.eq = f;
}

so don't write how

 
A100:

Compile so don't write how

No, it hardly works, but it does...
The bool type got lost in the typedef in the example.

#define PRINT(x) ; Print(#x, ":", string(x))

#define  CREATE_TestTypedef(type)                              \
class TestTypedef_##type{                                     \
public:                                                       \
   typedef bool (* callback_##type)(type &);                  \
   callback_##type  eq;                                        \
}
   
bool f(int&) {return true;}


void OnStart(){
   CREATE_TestTypedef(int) int_value;
   CREATE_TestTypedef(string) string_value;                     
   
   int data = 5;
   int_value.eq = f;
   PRINT(int_value.eq(data));                    // result: true
}
 
Until typedef fixes and namespace updates, if any, are released,
we will have to declare the use of each type separately via macros, and then use macros to get the name of the generated classes to create a class object...
 

Explain why when I createCChartObjectLabel I am not deleting objects in indicator when deinitializing in this code:

//+------------------------------------------------------------------+
//|                                                         test.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com/ru/users/igorm"
#property version   "1.00"
#property strict
#property indicator_separate_window
#include <ChartObjects\ChartObjectsTxtControls.mqh>
CChartObjectLabel *LabelUP,*LabelDN;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   CreateLabel(LabelUP,"LabelUP",0);
   CreateLabel(LabelDN,"LabelDN",30);
/*   
   LabelUP=new CChartObjectLabel;
   LabelDN=new CChartObjectLabel;
   LabelUP.Create(0,"LabelUP",ChartWindowFind(),0,0);
   LabelUP.Color(clrYellow);
   LabelUP.FontSize(14);
   LabelUP.Description("LabelUP");
   
   LabelDN.Create(0,"LabelDN",ChartWindowFind(),0,10);
   LabelDN.Color(clrYellow);
   LabelDN.FontSize(14);
   LabelDN.Description("LabelDN");
*/
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   delete LabelUP;
   delete LabelDN;
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   return(rates_total);

  }
//+------------------------------------------------------------------+
void CreateLabel(CChartObjectLabel *l,string name,int y)
  {
   l=new CChartObjectLabel;
   l.Create(0,name,ChartWindowFind(),0,y);
   l.Color(clrYellow);
   l.FontSize(14);
   l.Description(name);
  }
//+------------------------------------------------------------------+

when switching TF I get journal entry: 2019.05.23 09:49:02.044 tstlabel EURUSD,M30: 2 objects of type CChartObjectLabel left

if uncommented in OnInit() the creation of text labels (CChartObjectLabel), then everything will work correctly

I pass a pointer to theCreateLabel() function, butI can'tdelete it later inOnDeinit()

Reason: