Auto order cancel - NinjaTrader | futures io social day trading
futures io futures trading


Auto order cancel
Updated: Views / Replies:329 / 5
Created: by ttiller 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
 

Auto order cancel

  #1 (permalink)
Trading Apprentice
Pawleys Island SC
 
Futures Experience: Advanced
Platform: Ninja Tradestation
Favorite Futures: CL
 
Posts: 3 since Aug 2016
Thanks: 2 given, 1 received

Auto order cancel

Does anyone know of a way to automatically cancel a pending order at a price point with the ATM or a strategy?

Example: entry is pending to enter on a stop limit order short. However if the market rises to a certain price then we want to cancel the entry.

Thanks

Reply With Quote
 
  #2 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,361 since Sep 2013
Thanks: 1,644 given, 3,496 received
Forum Reputation: Legendary

You can use CancelOrder().
If a strategy has created an order, then it is aware of the context and can cancel the order.

If not, then the strategy can't 'watch' pending orders, and then would have to know when to cancel the order
using CancelOrder() at what level for long and short, you could read the DB directly for outstanding orders

Reply With Quote
 
  #3 (permalink)
Trading Apprentice
Pawleys Island SC
 
Futures Experience: Advanced
Platform: Ninja Tradestation
Favorite Futures: CL
 
Posts: 3 since Aug 2016
Thanks: 2 given, 1 received



rleplae View Post
You can use CancelOrder().
If a strategy has created an order, then it is aware of the context and can cancel the order.

If not, then the strategy can't 'watch' pending orders, and then would have to know when to cancel the order
using CancelOrder() at what level for long and short, you could read the DB directly for outstanding orders

So since the order would be manually entered, I would need to write a strategy to cancel it correct.

Reply With Quote
 
  #4 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,361 since Sep 2013
Thanks: 1,644 given, 3,496 received
Forum Reputation: Legendary


ttiller View Post
So since the order would be manually entered, I would need to write a strategy to cancel it correct.

Straight forward, a strategy can only cancel what i has 'started'.

 
Code
  private IOrder myEntryOrder = null;
  myEntryOrder = EnterLongLimit(0, true, 1, Low[0], "Long Entry");
  CancelOrder(myEntryOrder);
In your case you would not have the IOrder object.

You can however in a bit more advanced way, iterate through all the orders
as follows :

 
Code
		
		for (int i=0; i < NinjaTrader.Cbi.Globals.Accounts.Count; i++ ) {
		for (int j=0; j < NinjaTrader.Cbi.Globals.Accounts[i].Positions.Count; j++ )
		{
			Print(""
				+NinjaTrader.Cbi.Globals.Accounts[i].Name +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].Instrument.FullName +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].MarketPosition +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].Quantity +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].AvgPrice
			);
		}
		
		for (int j=0; j < NinjaTrader.Cbi.Globals.Accounts[i].Orders.Count; j++ ) 
		if (NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Filled == 0 && NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderState.ToString() != "Cancelled")
		{
			Print(""
				+NinjaTrader.Cbi.Globals.Accounts[i].Name +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Instrument.FullName +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderAction + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Quantity +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderType + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].LimitPrice + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].StopPrice + " "
			);
		}
	}

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,361 since Sep 2013
Thanks: 1,644 given, 3,496 received
Forum Reputation: Legendary

This might be helpful for you :

https://futures.io/ninjatrader/28541-strategy-position-account-position-2.html#post473328

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Pawleys Island SC
 
Futures Experience: Advanced
Platform: Ninja Tradestation
Favorite Futures: CL
 
Posts: 3 since Aug 2016
Thanks: 2 given, 1 received

Thanks! This will help a lot!

Thanks! This helps a lot!




rleplae View Post
Straight forward, a strategy can only cancel what i has 'started'.

 
Code
  private IOrder myEntryOrder = null;
  myEntryOrder = EnterLongLimit(0, true, 1, Low[0], "Long Entry");
  CancelOrder(myEntryOrder);
In your case you would not have the IOrder object.

You can however in a bit more advanced way, iterate through all the orders
as follows :

 
Code
		
		for (int i=0; i < NinjaTrader.Cbi.Globals.Accounts.Count; i++ ) {
		for (int j=0; j < NinjaTrader.Cbi.Globals.Accounts[i].Positions.Count; j++ )
		{
			Print(""
				+NinjaTrader.Cbi.Globals.Accounts[i].Name +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].Instrument.FullName +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].MarketPosition +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].Quantity +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Positions[j].AvgPrice
			);
		}
		
		for (int j=0; j < NinjaTrader.Cbi.Globals.Accounts[i].Orders.Count; j++ ) 
		if (NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Filled == 0 && NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderState.ToString() != "Cancelled")
		{
			Print(""
				+NinjaTrader.Cbi.Globals.Accounts[i].Name +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Instrument.FullName +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderAction + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].Quantity +" "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].OrderType + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].LimitPrice + " "
				+NinjaTrader.Cbi.Globals.Accounts[i].Orders[j].StopPrice + " "
			);
		}
	}


Reply With Quote
The following user says Thank You to ttiller for this post:

Reply



futures io > > > > Auto order cancel

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Opening Breakouts and Reversals w/Al Brooks

Elite only
 

Introducing daytradr by Jigsaw, new stand-alone platform

Oct 19
 

RandBots: AutoTrading Bots to diversify your trading

Oct 24
 

TopstepTrader: Profiting Without Risking Your Own Money

Oct 26

Building Open Source Indicators for NT8 w/Fat Tails @ Lizard Indicators

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel Pending Order Strategy Help! kidvic NinjaTrader Programming 9 November 1st, 2015 05:48 AM
Cancel Order olres7 NinjaTrader Programming 10 October 21st, 2015 11:57 AM
How to cancel an order at a specific time sburtt NinjaTrader Programming 3 August 15th, 2013 01:58 AM
cancel last order terratec NinjaTrader Programming 16 September 1st, 2011 01:17 PM
ATM Order Cancel Project Baseheadz NinjaTrader Programming 4 August 15th, 2011 11:32 PM


All times are GMT -4. The time now is 09:32 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-10-17 in 0.09 seconds with 19 queries on phoenix via your IP 54.156.67.122