Questions from Beginners MQL5 MT5 MetaTrader 5 - page 36

 
Dimka-novitsek:

Anyway, here is the function and its call

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

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

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

At least a semicolon is missing:

request.price=BID
 
Oh, THANK YOU!!! Sorry, really took a long time to notice. Yes, that's it!!! I mean, it compiled.Thanks again!!!
 
Right, 10016
TRADE_RETCODE_INVALID_STOPS
Incorrect stops in request
 
Dimka-novitsek:

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. I want to know more about it.

...

In order to understand this question in MQL5, we must first understand a simple (but fundamental) phrase:


A trade order is an order to change the state of a trade position


Thus, if we need to close a position, its type will not change, which means we will copy the stop and profit from the position into a new order and send it.

If the position should be reversed, we rearrange the fields.

In fact, a stop is a CCA (a pending order which is bound to the existence of the position and automatically has the same size and inverse type as the position) and a volume change order is a separate non-stop application to execute a transaction right now.

The complexity of understanding comes from the fact that these different position modification actions are carried out by one request.

But you can send a volume change request and a stop change request separately. In some dealings (e.g. market execution) it does not work the other way around.

In general, take a good look at the standard library, there are a lot of things implemented there.

 
Urain: But you can send an order separately for volume changes and separately for stop changes.
Um, I don't get it. If you send only a " volume change order", then SL==TP==0.0 in such an order, right? But when you execute such an order, the SL/TP levels of the position should be reset. So you're talking about a mandatory pairing of <'volume change order'+'stop change order'>?
 
Yedelkin:
Hm, I don't get it. If we send only a volume change request, in such a request SL==TP==0.0, right? But when such a bid is executed, the SL/TP levels of the position should be reset. So you mean the mandatory connection of <'volume change order'+'stop change order'>?

I'm talking about...

MQL5 Reference / Standard constants, enumerations and structures / Trade constants / Types of trade operations

TRADE_ACTION_DEAL and TRADE_ACTION_SLTP specifically , how you connect them is up to you, but it is possible.

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Типы торговых операций - Документация по MQL5
 
Urain: I'm talking about... MQL5 Reference / Standard constants, enumerations and structures / Trade constants / Types of trade operations

TRADE_ACTION_DEAL and TRADE_ACTION_SLTP specifically , how you link them is up to you, but it is possible .

OK, let me clarify a question: If we send only a "volume change request", it implies that SL==TP==0.0 in such a request, right?
 
Yedelkin:
OK, I'll clarify the question: If we send only a "volume change request", then it is assumed that SL==TP==0.0 in such a request, right?

firstly. You have called MqlTradeRequest in a strange and non "Russian" way, with some context that gives me the impression that the order is different from the position.

Secondly, when you answer yourself the question - what is an application, then this question about SL==TP will immediately disappear.

For the third time, why don't you try it in the terminal? Is it really necessary to discuss every sneeze of misunderstanding in the knowledge base on the forum?

then the question of SL==TP will go away. go to documentation, to practice in the terminal, to the tester, to scripting.

and only then come and ask

with shown for a specific discussion of the problem - the results of what you did and where you got the contradiction.

 

sergeev:

Yedelkin:
OK, let me clarify the question: If one only sends a "volume change request", then it is assumed that in such a request SL==TP==0.0, correct?

First of all. You called MqlTradeRequest strangely and not "in Russian".

Unfortunately, you have stopped following the topic in the evening. If someonecalled MqlTradeRequestin a strangeand non -Russian way, it certainly wasn't me. Please pay attention to the inverted commas and the reference to the author of the quoted statement. I am merely communicating with the author within the terminology he suggested. Personally, it doesn't annoy me at all.

sergeev : First, I get the impression that we do not understand how an order differs from a position.

Secondly - when you answer yourself the question - what is an application

Yes, it's the same thing.

sergeev : And third, for the umpteenth time, why don't you try it in the terminal? Does every sneeze of misunderstanding need to be discussed on the forum?

go to the documentation, to the practice in the terminal, to the tester, to the scripting tryouts.

You once again failed to notice that the question is addressed not to you, but to the specific author. And using his (the author's) terminology. To get an answer to such a question, you do not need to turn on the method of scientific poke. It is enough to hear the answer of the author, who asserts quite definite things. Is it really that hard to understand?

Fourthly, the topic is "For Beginners". Is it really so hard to answer a question quite definitively in this thread, without references to your favourite method? Could you have noticed who exactly raised the main question, and after which post my questions were voiced.

 
Yedelkin:

the stupid one will ask - what ten smart ones won't answer.
Reason: