[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1093

 
I have a similar question to Dimka-novitsek. Is there such a possibility: if we open a sell order OP_SELL on a symbol, without closing it, change it to buy order OP_BUY on our symbol (maybe, just change its number or something). Correspondingly this will change the deposit size in favor of the deal result + or -, but saving the spread. Or, do I just close the OP_SELL order and open a new OP_BUY order to buy, losing the spread? If such a possibility exists, may I see the ready code?
 
kolyango:
I have a similar question to Dimka-novitsek. Is there such a possibility: if we open a sell order OP_SELL on a symbol, without closing it, change it to buy order OP_BUY on our symbol (may only change its number or something). Correspondingly this will change the deposit size in favor of the deal result + or -, but saving the spread. Or, do I just close OP_SELL order and open a new OP_BUY order to buy, losing the spread? If such a possibility exists, may I see the ready code?

The order direction cannot be changed. You may only close 1 and open another.
 
kolyango:
I have a similar question to Dimka-novitsek. Is there such a possibility: if we open a sell order OP_SELL on a symbol, without closing it, change it to buy order OP_BUY on our symbol (may only change its number or something). Correspondingly this will change the deposit size in favor of the deal result + or -, but saving the spread. Or, do I just close OP_SELL order and open a new OP_BUY order to buy, losing the spread? If such a possibility exists, may I see the ready code?

Look at OrderCloseBy()
 
Vinin:

Look at OrderCloseBy()

The OrderCloseBy() function

bool OrderCloseBy(int ticket, int opposite, color Color=CLR_NONE)

This function closes one market order with another market order, opened for the same financial instrument, but in the opposite direction. The function returns TRUE if the function completes successfully and FALSE if the function fails.

Parameters:

ticket - The unique sequence number of the order to be closed.

Opposite - The unique sequence number of the opposite order.

Color - Color of the closing arrow on the chart. If the parameter is missing or its value is CLR_NONE, the arrow will not appear in the chart.

The size of opposite orders does not have to be the same. If the order sizes do not match, the trade operation is executed in the size of the smaller one of the orders.

And what if there is no other open market order in the opposite direction? Is it already impossible? If there is such a way, please help! Very much neednnnnn!!!!!!!!!!!!! Wouldn't want to lose another spread in case of consecutive close -> open...

 
kolyango:

OrderCloseBy() function

This function closes one market order with another market order open for the same financial instrument, but in the opposite direction. The function returns TRUE if the function completes successfully, and FALSE if the function fails.

Parameters:

ticket - The unique sequence number of the order to be closed.

Opposite - The unique sequence number of the opposite order.

Color - Color of the closing arrow on the chart. If the parameter is missing or its value is CLR_NONE, the arrow will not appear in the chart.

The size of opposite orders does not have to be the same. If the order sizes do not match, the trade operation is executed in the size of the smaller one of the orders.

And what if there is no other open market order in the opposite direction? Is it already impossible? If there is such a way, please help! Very much neednnnnn!!!!!!!!!!!!! Would really hate to lose another spread in case of consecutive close -> open...


I've seen it. And to think about it for a while?
 
kolyango:

OrderCloseBy() function

This function closes one market order with another market order open for the same financial instrument, but in the opposite direction. The function returns TRUE if the function completes successfully, and FALSE if the function fails.

Parameters:

ticket - The unique sequence number of the order to be closed.

Opposite - The unique sequence number of the opposite order.

Color - Color of the closing arrow on the chart. If the parameter is missing or its value is CLR_NONE, the arrow will not appear in the chart.

The size of opposite orders does not have to be the same. If the order sizes do not match, the trade operation is executed in the size of the smaller one of the orders.

And what if there is no other open market order in the opposite direction? Is it already impossible? If there is such a way, please help! Really need!!!!!!!!!!!!!

The OrderCloseBy() function is not good for flips. It just closes opposite orders.

To make a coup, you must either close one and open the opposite order, or open an order in the opposite direction with a lot twice as big as the first.

After that, you can use the OrderCloseBy() function, if you find it necessary.

Example:

If an open Sell LOT=0.1, open a Buy LOT=0.2 to reverse.

You can use OrderCloseBy() to "close" LOT=0.1 on both sell and buy, but leave only BAY LOT=0.1.

-

 
DhP:

The OrderCloseBy() function is not suitable for flips. It simply closes opposite orders.

To make a flip, you must either close one and open the opposite order, or open an order in the opposite direction, with a lot twice as large as the first.

After that, you can use the OrderCloseBy() function, if you find it necessary.

Example:

If an open Sell LOT=0.1, open a Buy LOT=0.2 to reverse.

You can use OrderCloseBy() to "close" LOT=0.1 on both sell and buy, but leave only BAY LOT=0.1.

-


Yes, but in that case there is no spread savings! It's all good, BUT if the market goes in the direction you choose, IF NOT - LOSS!
 
kolyango:

Yes, but in this case, there is no saving of the spread! All this is good, but if the market goes in the direction you have chosen, IF NO - you lose, AND TWO times more?


You will not be charged in this case (when using the feature) 2 spreads.

And in the event of a market reversal and with two orders, you do not receive a double loss, because the first open trade starts working for a profit. That is, in fact, only one LOT=0.1 is opened.

 


If you open Sell/Lot=0.1 for a rollover, open Buy/Lot=0.2.

You can use OrderCloseBy() function to "cancel" LOT=0.1 both at Sell and BAY, leaving only BAY LOT=0.1.

What is the point? When you open BAY BOT=0.2 you already take 2 times more, ie if you just closed BOT=0.1 and opened BOT=0.1 got the same!

 
kolyango:


If you opened Sell LOT=0.1 for a rollover, open Buy LOT=0.2.

You can use OrderCloseBy() function to "cancel" LOT=0.1 for both Sell and BAY, leaving only BAY LOT=0.1.

What is the point? When you open BAY LOT=0.2 you will already be charged twice as much, i.e. if you just closed LOT=0.1 and opened LOT=0.1 you will get the same!!!!


Check it out. It does not take long to do. One EA with normal closing, the other uses OrderCloseBy().

Compare the results and then say

Reason: