How to close the last trade EXACTLY at the open of the next trade? - page 5

 
Fernando Carreiro:

Sorry, but what you have described is simply not possible! A pending order can only trigger a market open, it cannot trigger the close of another order.

Plus, it cannot also do this at the same price at exactly the same time, because it is just impossible for orders in the same direction.

A Buy order opens at the Ask and closes at the Bid, and a Sell order opens at Bid and closes at Ask.

The only time two orders can open/close (one opens while the other closes) at the exact same price and time is if they are opposite orders, one Buy and the other Sell.

EDIT: Plus, you have already been told this on your other thread, but continue to insist on it:

I am not saying that the pending order should "trigger" the close of another position. I am saying the pending order should open the market open at the SAME price as the close of the last trade.

if you had looked at the time differences in depth, you would have realized that I had opened the other issue because nobody had answered this one because I had thought that this one was too vague or detailed to most.

 
nicholi shen:

So what you're saying is that you want a position of 1 -- which you then open a different position of 2 while simultaneously closing 1 leaving you with 2. You just blew 1 spread and 1 commission for no reason. Why??? All you had to do was leave the original open and add 1 to it. 


I have already answered this question you asked before. Please take a look. I open position 2 when position 1 goes 3 pips in the wrong direction. Think of a grid system but using closes at each level to prevent gigantic losses.

nicholi shen:

I get it, but why are you closing orders to open more? That doesn't make sense. 

As Mr. Carreiro said, it is to reduce exposure and the required margin.
 
marth tanaka:

I have already answered this question you asked before. Please take a look. I open position 2 when position 1 goes 3 pips in the wrong direction. Think of a grid system but using closes at each level to prevent gigantic losses.

As Mr. Carreiro said, it is to reduce exposure and the required margin.

I don't think you are grasping the concept of net position size.

 
marth tanaka:

I am not saying that the pending order should "trigger" the close of another position. I am saying the pending order should open the market open at the SAME price as the close of the last trade.

if you had looked at the time differences in depth, you would have realized that I had opened the other issue because nobody had answered this one because I had thought that this one was too vague or detailed to most.

I already answered this on post #3 and #5. And Fernando did it again some posts ago.

Is it clear for you why it's not possible if you want the exact same price (on every cases) ?

 
nicholi shen: So what you're saying is that you want a position of 1 -- which you then open a different position of 2 while simultaneously closing 1 leaving you with 2. You just blew 1 spread and 1 commission for no reason. Why??? All you had to do was leave the original open and add 1 to it. 

He probably read about the fact that for "hedged" orders, it lowers your exposure if you closed the first order instead of adding another to it, so he must of assumed that the same applies to orders in the same direction (which it does not).

Plus, he is also probably not including the loss of the order that is closed, and so the math incorrectly makes him believe that the second order has less exposure, which it actually does (at first glance), until you factor in the loss of the closed order (and then see that it is not).

So, @marth tanak, please take note of what I just wrote and redo your math. I know you stated that this is a coding exercise and that the profitability should not be questioned (because you blindly believe in it), but since the coding is also doomed to fail, because of the close/open conditions already described in previous posts, I urge you to do more research and return to the the drawing board.

 
Alain Verleyen:

I already answered this on post #3 and #5. And Fernando did it again some posts ago.

Is it clear for you why it's not possible if you want the exact same price (on every cases) ?

No I understand that. Fernando reiterated what I already knew--that you cant essentially buy/sell on the same price because Orderclose must use the price opposite to the ordersend as in bid/ask. However, I do not understand why it worked with limit orders in a real market.
 
marth tanaka: No I understand that. Fernando reiterated what I already knew--that you cant essentially buy/sell on the same price because Orderclose must use the price opposite to the ordersend as in bid/ask. However, I do not understand why it worked with limit orders in a real market.

I also already answered that! It only worked because the price reversed back in your favour. Had it continued going against you, you would not have been able to close the first order at the required price.

Would you like me to demonstrate this in an example or have you finally understood this?

 
Fernando Carreiro:

He probably read about the fact that for "hedged" orders, it lowers your exposure if you closed the first order instead of adding another to it, so he must of assumed that the same applies to orders in the same direction (which it does not).

Plus, he is also probably not including the loss of the order that is closed, and so the math incorrectly makes him believe that the second order has less exposure, which it actually does (at first glance), until you factor in the loss of the closed order (and then see that it is not).

So, @marth tanak, please take note of what I just wrote and redo your math. I know you stated that this is a coding exercise and that the profitability should not be questioned (because you blindly believe in it), but since the coding is also doomed to fail, because of the conditions already described in previous posts, I urge you to do more research and return to the the drawing board.

I did the math--without the loss of the closed order as you mentioned and that is EXACTLY why I am trying to close the last trade on the open of the next one because it would solve this problem. Cheers.
 
Fernando Carreiro:
I also already answered that! It only worked because the price reversed back in your favour. Had it continued going against you, you would not have been able to close the first order at the required price.
I see...

However when I tried to code this in and test on the backtester, my first order was still closed BUT at the wrong price so this proves this claim invalid I believe.
 
Fernando Carreiro:

I also already answered that! It only worked because the price reversed back in your favour. Had it continued going against you, you would not have been able to close the first order at the required price.

Would you like me to demonstrate this in an example or have you finally understood this?

A code example would be fantastic!