I'd like emulate the old-style limit orders, to do that I'm using the following piece of code:
[IntrabarOrderGeneration = True]
// old-style: Buy next bar at X limit
if (Close <= X) Then Buy this Bar;
// old-style: SellShort next bar at X limit
if (Close >= X) Then SellShort this Bar;
Since the close is checked at every tick, I would expect that the order is filled as soon as the condition is met, insted of the order is executed only at the close of the Bar, why ?
Emulating old-style Limit orders
-
- Posts: 60
- Joined: 21 Dec 2007
- Has thanked: 3 times
- Been thanked: 9 times
@danilo
Some of the rare words about intrabarorders from "Easy Language Essentials", Page 82:
Setting Intra-bar Order Generation Within your Code
You can programmatically turn on or off intra-bar order generation using an attribute at the beginning of your code. Attributes are switches set at the start of your code. Usage Example:
[IntraBarOrderGeneration = TRUE]
if Close > Close[1] then
Buy next bar at Market;
Here the strategy will generate a market order on the first tick that is higher than the previous bar close. When intra-bar order generation turned on, next bar really means next tick.
Some of the rare words about intrabarorders from "Easy Language Essentials", Page 82:
Setting Intra-bar Order Generation Within your Code
You can programmatically turn on or off intra-bar order generation using an attribute at the beginning of your code. Attributes are switches set at the start of your code. Usage Example:
[IntraBarOrderGeneration = TRUE]
if Close > Close[1] then
Buy next bar at Market;
Here the strategy will generate a market order on the first tick that is higher than the previous bar close. When intra-bar order generation turned on, next bar really means next tick.
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Danilo,SUPER,
"Next Bar at Market" is working !, I don't understand why in IOG mode "Buy this Bar" doesn't work since I believe that should send the order early.
In MultiCharts "Next Bar at Market" works and "Buy/Sell this Bar" (which is the same as "Buy/Sess this Bar at Close") does not work in IOG mode because this is the way such orders work in TS.
We do agree that logically this behavior is not perfectly correct, but for now we have decided to follow TS's logic - to make sure that TS native strategies work in MC in exactly the same way.
Marina,
It's OK, now that I have the old-style limit orders that are solid like a rock, I'm less worried regarding the back-compatibility. I have already "tested" HyperOrder for IB and I had the same problems that there are now on MC regarding the RELIABILITY of the TRUE limit orders, that it's so LOW that it's impossible to use the autotrading on a REAL accounts.
Kind Regards,
Danilo
It's OK, now that I have the old-style limit orders that are solid like a rock, I'm less worried regarding the back-compatibility. I have already "tested" HyperOrder for IB and I had the same problems that there are now on MC regarding the RELIABILITY of the TRUE limit orders, that it's so LOW that it's impossible to use the autotrading on a REAL accounts.
Kind Regards,
Danilo
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Dear Marina,
the following post contains the main issues regarding the NEW market limit orders:
1) http://forum.tssupport.com/viewtopic.php?t=5019
2) http://forum.tssupport.com/viewtopic.php?t=5042
In Summary is known that the TRUE market limit orders aren't guarantee that are filled and this can change some strategy behaviour and results, this is not a real bug but it's hard to do a reliable back-testing (see 1). To avoid this side-effect the possibility to convert the limit order to market order has been added but as new side-effect could happen (very often) that duplicated order are executed (see 2) since could happen that TWS dosn't send the confirmation that the limit order has been filled. Marina, I'm not asking the moon, even HyperOrder and NT offer the kind of option that I'm asking for and for me the "emulation" of market limit order is the best compromise between strategy's reliability and broker's execution reliability.
Best Regards,
Danilo
the following post contains the main issues regarding the NEW market limit orders:
1) http://forum.tssupport.com/viewtopic.php?t=5019
2) http://forum.tssupport.com/viewtopic.php?t=5042
In Summary is known that the TRUE market limit orders aren't guarantee that are filled and this can change some strategy behaviour and results, this is not a real bug but it's hard to do a reliable back-testing (see 1). To avoid this side-effect the possibility to convert the limit order to market order has been added but as new side-effect could happen (very often) that duplicated order are executed (see 2) since could happen that TWS dosn't send the confirmation that the limit order has been filled. Marina, I'm not asking the moon, even HyperOrder and NT offer the kind of option that I'm asking for and for me the "emulation" of market limit order is the best compromise between strategy's reliability and broker's execution reliability.
Best Regards,
Danilo
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007