Errors, bugs, questions - page 1917

 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.06.15 10:08

Why does it compile?
class A {};

class B : public A
{
public:  
  int i;
};

void OnStart()
{
  A* a = new B;
  
  ((B*)a).i = 1;
  
  dynamic_cast<B*>(a).i = 1;
  
  delete a;
}
Support Team 2017.06.29 12:04
Why shouldn't it compile?

A is the ancestor of B, so the conversion can be valid, validity is checked and if the object conversion is not possible an exception is thrown and the MQL program terminates.

In contrast to explicit conversion dynamic_cast does not raise an exception but returns NULL instead, in which case the program will continue execution.
 
Vladimir Karputov:

Set the speed to minus three steps from the maximum - otherwise interface updates are not guaranteed.

This speed is in the middle - it's a long way to the maximum there
 
SymbolInfoDouble(_Symbol,SYMBOL_MARGIN_INITIAL)

SymbolInfoDouble(_Symbol,SYMBOL_MARGIN_MAINTENANCE)
always returns 0.0 in the tester for some reason

the error code is also 0

 
Anton Ohmat:
for some reason it always returns 0.0

the error code is also 0

This thing, as far as I understand, only works on the Moscow Exchange

 
Help please!!!!!!!! The "1-click trading" button is not displayed in the terminal 1090. I've done everything possible. I've also ticked the box in the properties. It is not displayed as a line open order!!! What to do?
 
vati-vv:
Help please!!!!!!!! In the terminal 1090 the button "Trade in 1 click" is not displayed. I have done everything possible. I have also checked it in properties. It is not displayed as a line open order!!! What to do?

You have now posted your question in the MQL5 section. For the old terminal, you should post your questions in theMQL4 and MetaTrader 4 sections.

It is advisable to check if you are logged in to the trading server, as the quick trading panel is displayed only when you are actually logged in to your trading account.

 

Hi, in mql5 I use the following way of specifying filling_mode

   if(SymbolInfoInteger(Symbol(),SYMBOL_FILLING_MODE)==SYMBOL_FILLING_FOK)
     {
      tradeBuy.SetTypeFilling(ORDER_FILLING_FOK);
      tradeSell.SetTypeFilling(ORDER_FILLING_FOK);
     }

   else if(SymbolInfoInteger(Symbol(),SYMBOL_FILLING_MODE)==SYMBOL_FILLING_IOC)
     {
      tradeBuy.SetTypeFilling(ORDER_FILLING_IOC);
      tradeSell.SetTypeFilling(ORDER_FILLING_IOC);
     }

   else
     {
      tradeBuy.SetTypeFilling(ORDER_FILLING_RETURN);
      tradeSell.SetTypeFilling(ORDER_FILLING_RETURN);
     }


In the tester the EA opens positions, but about one position does not open and error unsupported filling mode, what am I doing wrong?

 
Dmitry Melnichenko:

Hi, in mql5 I use the following way of specifying filling_mode


In the tester an EA opens positions, but some positions are not opened and error unsupported filling mode, what am I doing wrong?


It is not one value that is returned but a composite of one or two - that's why the check may be incorrect.

Try such a construction:

//---
   if(IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_FOK))
      m_trade.SetTypeFilling(ORDER_FILLING_FOK);
   else if(IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_IOC))
      m_trade.SetTypeFilling(ORDER_FILLING_IOC);
   else
      m_trade.SetTypeFilling(ORDER_FILLING_RETURN);
...
//+------------------------------------------------------------------+ 
//| Checks if the specified filling mode is allowed                  | 
//+------------------------------------------------------------------+ 
bool IsFillingTypeAllowed(string symbol,int fill_type)
  {
//--- Obtain the value of the property that describes allowed filling modes 
   int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- Return true, if mode fill_type is allowed 
   return((filling & fill_type)==fill_type);
  }


Added: if it helped, please let me know.

 
Vladimir Karputov:

It is not a single value that is returned, but a composite of one, or two - so you may get an incorrect check.

Try this construction:


Added: if it helped, please let me know.


Thanks, but it didn't help, it still periodically gives this error!

 

How do I know the window/subwindow number of an object? I don't see a matching property.