Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
IOG causing my limit order to cancel and replace intrabar
I would appreciate any help in figuring out how to fix this problem. My orders just keep firing and then being canceled immediately. It will do this like 15 times right in a row. I am running an automated strategy on MC 7 beta 4 with rithmic as my broker.
When my condition is met intrabar (3 min bars), I need a limit order to be placed at the low ( this is when the strategy is going long) of the last 3 bars:
begin
BUY One CONTRACT NEXT BAR Lowest (LOW, 3)[1] LIMIT ;
So my scripts places the limit order at the proper place at the low of the last 3 minute bars. A limit order is placed, then a second later it will be canceled. It will just keep rapid firing orders and then canceling them. Without IOG turned on, a limit order will be placed and then stay there until the 3 min bar forms and any outstanding orders are canceled and that strategy will recalculate to decide if it wants to reenter the order. I understand that with intrabarorder generation (IOG) turned on, every tick is considered a bar. So therefore on every tick, a order is generated and then canceled unless the price is very close by. I really need IOG turned on because of stop loss and day loss limit occurrences that happen intrabar and need an order to be fired to go flat.
Multicharts help desk tells me that if I have IOG turned on, my script needs to resend the order on every tick until the end of the three min bar in order for the standing limit order not to be canceled intrabar.
Anyone else ever run into this problem or similar problems with IOG?
I have tried placing intrabarpersist in front of all the variables and that doesn't help anything.
Any suggestions or comments?
Sheldon
Can you help answer these questions from other members on NexusFi?
I believe it is normal behavior. You might try setting a var to track whether or not you've submitted an order on that bar already, and if so, stop doing it again. But what I think will happen is MultiCharts will cancel the pending/unfilled order and not resubmit it in this case.
In this regard, NinjaTrader has the upper hand because it has the ability to let you override how long an order stays in the market.
Are you absolutely certain it is actually resending the orders to your broker? It was my understanding that a duplicate order (limit bid, etc) would not be resent across the wire.
While not of huge help to you today, in August we're having a webinar on Systematic trading with an expert who uses MultiCharts. He may be able to comment
I am sure that it is resending the order. I have R-Trader open as well to track the trades in my account. It will keep sending the order and then canceling it for about 10 to 15 times, then the limit will stick there. I am just trying to eliminate all of the canceled orders. CME does not like too many canceled orders.
I will also try to find out what I can about the hold values. It is really annoying to see all the cancelled orders. Plus it will throw an error message saying:
The order management system rejected request.
I think this has to do with trying to change targets and stops after the original order has already been canceled.
Thanks for the input.
Sheldon
Hi,
Thanks for your reply. Is there anyway that you could copy and paste an example of this variable at end of sequence?
Unfortunately, I do not know a whole lot about coding.
Thanks in advance,
Sheldon
This should hold your entry signals to the "cross" of the entry from flat to positive/negative.
I think what may be happening is that your entry is getting replicated after each tick and because the strategy has no way of tracking an outstanding/unfilled order and it's simply cancelling your order and reissuing it after each tick (until it somehow finally gets filled).
"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Thanks so much for the idea. I tried that and it did not help any. From what I can tell from what I can tell reading about intrabar order generation in the Tradestation Essentials Programmers Guide, orders that are placed when strategy is in IOG mode will only last one tick and then they will be canceled. This would work fine if I was placing market orders, but the strategy is placing orders a few ticks from the market price as a limit order. Therefore most of the time it gets canceled and replaced many times till price gets close enough to get filled.
So the next step is to figure out how to continue to issue the stop or limit orders each bar (or intrabar tick with IOG Turned on) until the order is filled or for as long as your entry / exit conditions in your strategy warrant that the orders should remain active.
A problem arises when you start using "next bar ..." and tick data. If Intrabar order generation is enabled, then the order for "next bar ..." may only be valid for the next tick, so you have to keep issuing the order.
I found this on another thread. Thanks Brett. I am working (searching for examples) on the exact code to add to my script to have my system keep my limit order open at the broker until the end of the 3 min bar with IOG turned on.
I will posted my script example when I have it working.
Sheldon
I started my coding based on example code that Bretter had posted from the tradestation forum:
variables:
IntraBarPersist Count( 0 ) ;
if BarStatus( 1 ) = 2 then Count = 0 ;
if {trade conditions happens} then Count = Count + 1 ;
if MarketPosition <> 1 and Count > 5 then
begin
{ buy/sell order}
end ;
I got my limit orders to hold now until the new bar opens. This script will repeat the order until Barstatus(1) = 0
(occurs with the first tick of a new bar). The only downside of this is that your charts have to have bar magnifier turned on and set to 1 tick resolution. This is for minute charts or tick bars. But if you want accurate testing, that is what you will want turned on anyway. With multicharts being only 32 bit at this point, I can only use 2 GB of the 12 GB that is available, which really reeks. So backtesting is a limited at this point to smaller time series. Multicharts is supposed to have 64 bit platform by the end of this year. I can't wait.