Errors, bugs, questions - page 1695

 
Rashid Umarov:
What does ORDER_TYPE_BUY mean? Just print it out and make sure that it is 0. So, there is no order there.

I.e. after opening a position in MqlTradeTransaction structure order_type is just not available? Or is it just 0 regardless?

Rashid, if you don't mind, could you give me an easier answer? Well, I'll print it out and it will be 0, but how should I understand it?


Here we go... While I was typing, Vladimir gave me a comprehensive answer. Thank you, I got it. As always, I didn't read the documentation...

 
Karputov Vladimir:

For different types of transactions different fields of MqlTradeTransaction structure are filled in:

as you can see, for TRADE_TRANSACTION_DEAL_ADD the .order_type is not filled in.

By the way, it is sometimes misleading. why, if the value is not filled in, it cannot be specified as WRONG_VALUE, for instance?
 
Alexey Viktorov:


Rashid, if it's not too much trouble, can you give me a simpler answer? So I'll print it out, it will be 0, but how do I understand it?

In this case you do not need to look at the order type - it is simply not there
 
Alexey Kozitsyn:
By the way, this is sometimes misleading... Why can't it be specified as WRONG_VALUE, for example, if the value is not filled in?
Stepped on this rake myself. Can't tell )
 
Rashid Umarov:
I've stepped on this rake myself. I can't tell )
It's just that WRONG_VALUE is implicitly cast to the type of any enumeration, right? So you would))
 
Rashid Umarov:
No need to look at the order type in this case - it's just not there

How slow I am at typing... While editing my post...

Alexey Viktorov:

Added.

Well... While typing, Vladimir gave me a comprehensive answer. Thanks a lot. As always I haven't read the documentation...

Thank you.

 

How do I know my handle on a chart in an indicator?ChartIndicatorName is not suitable, because it returns a short name. And with the same name may be already running the same indicator with different input parameters.

I need it to be able to remove the indicator from the chart and its calculations.

 
fxsaber:

How do I know my handle on a chart in an indicator?ChartIndicatorName is not suitable, because it returns a short name. And with the same name may be already running the same indicator with different input parameters.

I need it to be able to remove the indicator from the chart and its calculations.

What if I change the short name when I create it?
 

Shouldn't my example inherit / take a method from a parent class??? How to get a method of parent in derived classes to use it later.

So the parent class has methods "one, two, three" I want to use only method "two and three" in descendant and not to see method "one" and also that "two and three" will be available later

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class test
  {
public:

   int rezult(void)
     {
      static int t=0;
      t++;
      return t;
     }
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class test_end : public test
  {
public:
   virtual int       rezult(void);
  };

test_end go;
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   go.rezult();
// 'rezult' - function must have a body TEst.mq4        42      7
  }
//+------------------------------------------------------------------+
 
Vladimir Pastushak:

Shouldn't my example inherit / take a method from a parent class??? How to get a method of parent in derived classes to use it later.

So the parent class has methods "one, two, three" I want to use only method "two and three" in descendant and not to see method "one" and also that "two and three" will be available further

Firstly, it is not clear whether an attempt was made to declare a method as virtual or not. If it must be virtual, then write virtual in a base class, not in a derived one (because otherwise base pointers will be resold to the base method even if you put a derived class instance into it).

If you don't want to override a method in a derived class, don't mention it at all, and if you do, it should be overridden with a body.

Finally, to hide the method from the derived class, you need to introduce an intermediate class where this method should be moved to the priivate area or made private in the base class (but why is it virtual then?).