Scripts: ClosePosition - page 3

 
fxsaber:
Well, it's easy to add a closed volume to the code.

You don't understand the essence of the script! The name of the script is"Close position"! And there are ten positions! The original logic of the script assumes only one position. And your code is completely useless. A line is quite enough:

request.position=PositionGetInteger(POSITION_TICKET);
 
Nikolay Kositsin:
You don't understand the essence of the script! The name of the script is"Close position"! And there are ten positions! The original logic of the script assumes only one position.

Even on MT5-Hedge and MT4 there is always one net position. The algorithm is as follows

  1. We calculated the size and direction of the net position.
  2. Open a position for the specified volume against it.
  3. Slammed the NEW position by OrderCloseBy.

 
Nikolay Kositsin:

And your code is completely useless. A line is enough:

request.position=PositionGetInteger(POSITION_TICKET);
If we're talking about worthlessness, here it is.
request.type_filling=ORDER_FILLING_FOK;
 
fxsaber:

The net position even on MT5-Hedge and MT4 is always the same. The algorithm is as follows

  1. Calculate the size and direction of the net position.
  2. Open a position for the specified volume against it.
  3. We slammed the NEW position by OrderCloseBy.

This is a conversation about nothing in the style: "If grandma were a grandfather and had a penis....". The script closes only one position in the terminal and that's all!
 
Nikolay Kositsin:
This is a conversation about nothing in the style: "If grandma were a grandfather and had a penis....". The script closes only one position in the terminal and that's all!
Metaquotes-Demo, Si-3.17, Netting - try it!
 
fxsaber:
Speaking of worthlessness, here it is
request.type_filling=ORDER_FILLING_FOK;
Unfortunately, this applies to ALL your Expert Advisors - TradeAlgorithms.mqh
 
fxsaber:
Unfortunately, this applies to ALL your Expert Advisors - TradeAlgorithms.mqh
You drew a bunch of code demonstrating your erudition, but absolutely inappropriate in this particular situation, I drew only one line of code, but in place to solve the problem and in passing pointed out the original meaning of this script. That's it!
 
Nikolay Kositsin:
You drew a bunch of code demonstrating your erudition but absolutely inappropriate in this particular situation, I drew only one line of code, but in place to solve the problem and in passing pointed out the original meaning of this script. That's it!

Unfortunately, you don't see the problem - your trading codes only work on symbols that support ORDER_FILLING_FOK. On others (for example, stock symbols) - will not work.

Here is an example

Forum on trading, automated trading systems and testing trading strategies

Scripts: ClosePosition

fxsaber, 2017.02.21 09:42 pm.

Metaquotes-Demo, Si-3.17, Netting - try it!
 
fxsaber:

Unfortunately, you don't see the problem - your trade codes only work on symbols that support ORDER_FILLING_FOK. On others (e.g. stock symbols) - will not work.

Here is an example

This conversation is about nothing. In the context of this situation, the conversation was about a completely different problem. Why substitute concepts? As for the exchange, any codes cannot be infinitely universal. If it is so urgent for you, then flag in your hands, open a topic on the forum and develop it, who is stopping you?
 

Nikolay Kositsin:
Разговор ни об чём. В контексте данной ситуации разговор шёл о совсем другой проблеме.

You react strangely when you are clearly shown that the script does not work.

Why substitute concepts? As for the exchange, any codes cannot be infinitely universal. If it is so urgent for you, then flag in your hands, open a topic on the forum and develop it, who prevents you?
They can, you are just not in the subject.