IOG causing my limit order to cancel and replace intrabar - EasyLanguage Programming | futures io social day trading
futures io futures trading


IOG causing my limit order to cancel and replace intrabar
Updated: Views / Replies:5,171 / 10
Created: by tradersheldon Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

IOG causing my limit order to cancel and replace intrabar

  #1 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received

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

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,214 received


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

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Fortitudo et Honor
Austin, TX
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 882 since Mar 2011
Thanks: 128 given, 703 received

Definitely need a coding guru here.

Might be a "hold" issue.

I know I was having issues with IOG and reissue and part of the code solution was to "hold" a value.

I'm at the limit of my computer science understanding when I say I still do not understand how it works...

but placing

variable=variable at the end of a sequence somehow "holds" the value and keeps it from being variable (in some instances).

Try searching for "hold value" etc on some of the programming support forums.

"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."
Reply With Quote
The following user says Thank You to RM99 for this post:
 
  #5 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received


Big Mike View Post
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

Mike


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

Reply With Quote
 
  #6 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received

Example of hold value


RM99 View Post
Definitely need a coding guru here.

Might be a "hold" issue.

I know I was having issues with IOG and reissue and part of the code solution was to "hold" a value.

I'm at the limit of my computer science understanding when I say I still do not understand how it works...

but placing

variable=variable at the end of a sequence somehow "holds" the value and keeps it from being variable (in some instances).

Try searching for "hold value" etc on some of the programming support forums.


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

Reply With Quote
 
  #7 (permalink)
Fortitudo et Honor
Austin, TX
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 882 since Mar 2011
Thanks: 128 given, 703 received

Try this...

 
Code
 
variables: intrabarpersist tradetrigger(0);
 
tradetrigger = 0;
 
if (entry condition = buy) then tradetrigger = 1;
if (entry condition = sell) then tradetrigger = -1;
 
if marketposition = 0 then begin
 
If tradetrigger[1] = 0 and tradetrigger = 1 then begin
Buy next bar at (limit location) limit;
end;
 
if tradetrigger[1] = 0 and tradetrigger = -1 then begin
Sellshort next bar at (limit location) limit;
end;
 
end;
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."
Reply With Quote
The following 3 users say Thank You to RM99 for this post:
 
  #8 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received


RM99 View Post
Try this...

 
Code
 
variables: intrabarpersist tradetrigger(0);
 
tradetrigger = 0;
 
if (entry condition = buy) then tradetrigger = 1;
if (entry condition = sell) then tradetrigger = -1;
 
if marketposition = 0 then begin
 
If tradetrigger[1] = 0 and tradetrigger = 1 then begin
Buy next bar at (limit location) limit;
end;
 
if tradetrigger[1] = 0 and tradetrigger = -1 then begin
Sellshort next bar at (limit location) limit;
end;
 
end;
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).


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.

Here is a post in the tradestation forum that I cannot access concerning this issue:
https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=36477
Can a tradestation user open it and copy and paste thread back here?
Many thanks,
Sheldon

Reply With Quote
 
  #9 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received


bretter View Post
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.

Example code:
More detail on IOG:
https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=36421



I hope this helps!
Brett

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

Reply With Quote
 
  #10 (permalink)
Elite Member
Western Maryland
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Vision Financial (Direct)/ CQG, Rithmic
Favorite Futures: Gold, Euro, ES
 
Posts: 39 since Sep 2010
Thanks: 20 given, 49 received

Example of code to repeat limit order


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.

Reply With Quote

Reply



futures io > > > > > IOG causing my limit order to cancel and replace intrabar

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
cancel last order terratec NinjaTrader Programming 16 September 1st, 2011 02:17 PM
ATM Order Cancel Project Baseheadz NinjaTrader Programming 4 August 16th, 2011 12:32 AM
Help wanted! Long/short strategy with cancel order and trail stop mrticks NinjaTrader Programming 9 October 26th, 2010 05:15 PM
Stop Limit Order Big Mike Terms (Glossary) 0 July 2nd, 2010 12:37 PM
Limit Order LukeGeniol Terms (Glossary) 0 June 29th, 2010 02:38 AM


All times are GMT -4. The time now is 09:22 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-11 in 0.18 seconds with 19 queries on phoenix via your IP 54.226.227.175