Hi guys,
I've been looking for the answer for couple hours and still haven't found any clue.
I am trying to code to place a stop order with "buy this bar".
I want the order to be executed immediately when it meets the target price such as buy this bar at 100 stop.
But this bar only works with close from my research.
Is there any way to make it work ?
can "buy this bar" work with stop order?
-
- Posts: 117
- Joined: 08 Nov 2005
- Been thanked: 3 times
Re: can "buy this bar" work with stop order?
normaly I use for target profit... limit order and stoploss I use stop orderHi guys,
I've been looking for the answer for couple hours and still haven't found any clue.
I am trying to code to place a stop order with "buy this bar".
I want the order to be executed immediately when it meets the target price such as buy this bar at 100 stop.
But this bar only works with close from my research.
Is there any way to make it work ?
Try this
1 .......buy next bar yourprice limit;
or
enable intra-bar-order generation
and put buy next bar yourprice limit;
you get different results
jo
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
Think about it this way. You're a discretionary trader - it's the end of this 30 minute bar. You would like to buy "this bar" using a stop order, if price exceeded a certain price. How would you do that? No matter what you do, if it's the end of this 30 minute bar, you are going to get an execution at or near the open of the NEXT 30 minute bar. Automation is no different. If you wanted to get an historical execution BEFORE the end of the 30 minute bar, you would either have to have placed the order at the end of the previous bar (a NEXT bar order) or you would have to use smaller bars such as 1 minute bars, so you could have an opportunity to adjust your orders before the 30 minute bar is completed.
This is simply a general philosophical situation - you can't BOTH know the closing price AND put in an order and get an execution before the close (though you can try - using smaller bars and waiting until the larger bar's almost closed to estimate.)
Having automation that allows you to fool yourself and get an historical trade execution that you can't get in real life would be doing you a disservice, in that it would encourage you to think something was possible that really is not. The job of a good back test engine is to tell you "what would have happened" as best is reasonably possible.
It's quite likely that you can do what you want to do by re-envisioning the task in a different way - placing the order at the end of the previous bar, or as a next bar order on the current bar, or using smaller historical bars.
Or, if it's a "forward-testing" situation that doesn't require any historical fill simulation / back-testing, you may be able to do what you want using intrabar order generation.
This is simply a general philosophical situation - you can't BOTH know the closing price AND put in an order and get an execution before the close (though you can try - using smaller bars and waiting until the larger bar's almost closed to estimate.)
Having automation that allows you to fool yourself and get an historical trade execution that you can't get in real life would be doing you a disservice, in that it would encourage you to think something was possible that really is not. The job of a good back test engine is to tell you "what would have happened" as best is reasonably possible.
It's quite likely that you can do what you want to do by re-envisioning the task in a different way - placing the order at the end of the previous bar, or as a next bar order on the current bar, or using smaller historical bars.
Or, if it's a "forward-testing" situation that doesn't require any historical fill simulation / back-testing, you may be able to do what you want using intrabar order generation.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact: