Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 718

 
Artyom Trishkin:

Error 1 is no error, but the result is unknown. The point is that you are trying to modify the stop to the same price at which it is already set. Before modifying it, compare the price of the stop with the price at which you want to set it. If it is already at that price, there is nothing to modify.

Is there such a thing, or is there something wrong?

 
Andrey Sokolov:

Is there such a thing, or is there something wrong?

There's no such thing there. Then question: did you write ...

Made a function that when an order reaches ... ... ...

... why are you asking if it's there or not? If you did it yourself, you should know exactly what you did. Or what? I can hardly imagine doing something without knowing what I'm doing...

 
Artyom Trishkin:

It's not there. Then the question is: did you write...

... why are you asking if it's there or not? If you did it yourself, you should know exactly what you did. Or what? I can hardly imagine doing something without knowing what I'm doing...

 if (OrderStopLoss()!=OrderOpenPrice()

Need to move the sl to the opening price, here, checking that it's not there. What's wrong?

 
Andrey Sokolov:

Need to move the sl to the opening price, here, checking that it's not there. What's wrong?

Is the opening price of the order the stop price?

 
Artyom Trishkin:

Is the opening price of the order the stop price?

So if we modify the sl to the open price, isn't it?

 
Andrey Sokolov:

So if the modification transfers the sl to the opening price, isn't it?

What happens next time?

 
Artyom Trishkin:

What happens next time?

And next time it won't beOrderStopLoss()!=OrderOpenPrice()

no?

 
coldunprofi:

Hi, how to make the EA open positions with a specified volume of single orders of both positions according to external variables, e.g.

The volume of a single order is 1.35 lots, the total volume of the open positions is 500 lots. The EA opens a buy order of 1.35 lots, and then opens a sell order of 1.35 lots,

and then repeats until 500 lots buy and 500 lots sell are opened, and since the number of lots is not a multiple of 1.35, the last order must be less than 1.35

Take any panel in CodeBase, deal with the source code and now when it appears/external variables, let it do the same actions as for the buttons. It will just periodically poll variables (e.g. in timer) and emulate button presses
 
coldunprofi:

Hi, how to make an EA open a position with a specified volume of a single order of both positions according to external variables, e.g.

The volume of a single order is 1.35 lots, the total volume of open positions is 500 lots, the Expert Advisor opens a buy order of 1.35 lots, then it opens a sell order of 1.35 lots,

and then repeat until 500 lots buy and 500 lots sell are opened, and since the number of lots is not a multiple of 1.35, the last order must be less than 1.35

Hi. Wouldn't it be easier to do it this way

MathMin(Lot,500-(общий лот уже открытых ордеров))
where Lot for example will be 1.35
 
Andrey Sokolov:

And next time it won't beOrderStopLoss()!=OrderOpenPrice()

won't it?

Before OrderModify() print the values of the opening price and the new stop price.

And keep your disrespectful "no?" to yourself if you want help. However, I have posted a fully working template for any trawl in this thread - you can look it up.