Questions from Beginners MQL5 MT5 MetaTrader 5 - page 35

 
alxm:
The documentation says you don't have to strain yourself.
OK, then.
 
alxm:
The documentation says that there is no need to bother.

But the phrase"For objects containing strings and dynamic arrays, ZeroMemory() is called for each member" is a bit ambiguous. Either ZeroMemory function itself performs this zeroing, or the programmer should make the call himself/herself for each member containing a dynamic array.

..Although. The cases of inapplicability are clearly specified.

 
Yedelkin:
But the phrase"For objects containing strings and dynamic arrays, ZeroMemory() is called for each member" is ambiguous. Either this zeroing is performed by the ZeroMemory function itself or the programmer should zero each dynamic array himself/herself.
Andshould the phrase"for arrays of complex objects ZeroMemory() is called for each item" be understood as a call to zero each item separately too?
 
alxm:
And the phrase"For arrays of complex objects ZeroMemory() is called for each element" should also be understood as a call to zero each element separately?
Well, and as a last resort it can be easily checked. :)
 
alxm:
And the phrase"For arrays of complex objects ZeroMemory() is called for each element" should also be understood as a call to zero each element separately?
Well, yes, compare the meaning of the Russian verb "produced" with the meaning of the Russian verb "occurs" :) Answer: no, it shouldn't.
 
Yedelkin:
Yes, compare the meaning of the Russian verb "produced" with the meaning of the Russian verb "occurs" :) The answer is no, it shouldn't.
I agree. The documentation should be written in such a way that there is no thought of a double interpretation.
 

Good afternoon! Suppose I close part of a position by opening a reverse position. What stop loss and profit should I set? Probably it will be the one I set, and not the one I had? No, it cannot be, I will open a reverse trade to reduce the position and the profit and loss are the same as in the previous one. All in all, I got myself confused. Please, help me to clarify.

Also, the structure has an error

 MqlTradeRequest request={0};
      MqlTradeResult result={0};

      request.action= TRADE_ACTION_DEAL;
      request.magic =MagicNumber;
      request.symbol=symb;
      request.price=BID
      request.deviation=30* Point(symb);
      request.volume=Lot;
      request.sl=s;
      request.tp=t;
      request.type=type;
      OrderSend(request,result);  

'deviation' - some operator expected htghtgfhthf.mq5 103 15 operator calculated.... Well, calculated.

'Point' - wrong parameters count htghtgfhthf.mq5 103 30

I think everything is correct?? In short, please tell me what to put in it, so it would not swear?

 
Dimka-novitsek: Also, the structure is cursed with

This is what it says:

Point(symb);

No arguments are provided for this function.

Also, see description of deviation field. There is no need to assign double values to it.

 

Now here is the situation. I want to set the lot for the opposite position, for this I find out the lot of the trade, which participated in this combined position, and set the opposite position, that is, I would like to try to set. This lot I recognize with function HistoryDealGetDouble( TicetTojSdelki,DEAL_VOLUME).

Anyway, here is the function and its call

    if ( HistoryDealGetInteger( TicetTojSdelki,DEAL_TYPE)== DEAL_TYPE_BUY){
     OrderSendSELL( Symbol(),"OP_SELL",  HistoryDealGetDouble( TicetTojSdelki,DEAL_VOLUME), 10,10, 300,  300, " com " , 600, 600,0)
  ;}
  
  
                                                          }
 
   
   }
   
   
   
   
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+     
 ulong OrderSendSELL(string symb, string OP_POZA, double Lot, double BIDd,int slip, double  s,  double  t, string com, int MagicNumber, datetime expiration,color c){
  
         ENUM_ORDER_TYPE   type;
         if(OP_POZA=="OP_SELL"){type=ORDER_TYPE_SELL;}
        double BID =BID( symb);
          if(OP_POZA=="OP_BUY"){type=ORDER_TYPE_BUY;}
            BID =ASK( symb);
          

      MqlTradeRequest request={0};
      MqlTradeResult result={0};

      request.action= TRADE_ACTION_DEAL;
      request.magic =MagicNumber;
      request.symbol=symb;
      request.price=BID
     
      request.volume=Lot;
      request.sl=s;
      request.tp=t;
      request.type=type;
      OrderSend(request,result);    
      
        return (result.   deal );       }
 
 //+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double BID(string symbol) 
  {
   MqlTick last_tick;
   SymbolInfoTick(symbol,last_tick);
   double BID=last_tick.bid;
   return(BID);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double ASK(string symbol) 
  {

   MqlTick last_tick;
   SymbolInfoTick(symbol,last_tick);
   double ASK=last_tick.ask;
   return(ASK);  
  }

'Volume' - some operator expected htghtgfhthf.mq5 104 15

'Lot' - expression has no effect htghtgfhthf.mq5 104 22

It's the structure itself that's getting scolded. Variable dowble... Lot equals lot... I don't understand it!

 
Thank you!!!
Reason: