CancelOrder on multiple contracts - NinjaTrader Programming | futures io social day trading
futures io futures trading


CancelOrder on multiple contracts
Updated: Views / Replies:1,052 / 7
Created: by NinjaStrategies Attachments:1

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
 

CancelOrder on multiple contracts

  #1 (permalink)
Trading Apprentice
Netherlands
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 10 since Feb 2011
Thanks: 0 given, 0 received

CancelOrder on multiple contracts

I am working on a strategy that can be used with multiple contracts.
It is using limitorders and when they are not filled, a condition must cancel them.

The problem is: only one contract is cancelled, see below.

//Entering Trades
if (Contracts==2) {entryOrderLong = EnterLongLimit(0,true,1,BuyPrice1,"EL1");entryOrderLong = EnterLongLimit)0,true,1,BuyPrice1,"EL2");}

//Cancelorders
if (Position.MarketPosition == MarketPosition.Flat && entryOrderLong != null && Close[0]>=CancelPrice)
{
CancelOrder(entryOrderLong);
}

How do I get both contracts cancelled?

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)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,067 received


you might get some clues here https://futures.io/ninjatrader-programming/6116-help-wanted-long-short-strategy-cancel-order-trail-stop.html

Reply With Quote
 
  #4 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

you can simply use
 
Code
CancelAllOrders(....)
alternatively for better management (i.e. not only for cancelling orders) i would prefer to have a list, like

in variables
 
Code
private List<IOrder> list = new List<IOrder>();

the trade managements
 
Code
IOrder order = EnterLong(....);
list.Add(order);
//enter the second order
order = EnterLong(...);
listAdd(order);

//cancellation logic

 
Code
for (int i = 0; i < list.Count; i++)
{
        if (condition)
        {
                CancelOrder(list[i])
         }
}

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Netherlands
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 10 since Feb 2011
Thanks: 0 given, 0 received


bukkan View Post
you can simply use
 
Code
CancelAllOrders(....)

I am using the managed approach and CancelAllOrders does not exist.

I am not that good in programming to fix it the other way you mentioned.

Everything works with 1 contract but using 2 or 3 contracts only one is cancelled.

Is there a way to edit my own code to fix this?

Reply With Quote
 
  #6 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

are you using the bool overloads

Attached Thumbnails
CancelOrder on multiple contracts-cao.png  
Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Netherlands
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 10 since Feb 2011
Thanks: 0 given, 0 received


bukkan View Post
are you using the bool overloads

Can you give me a direction howto add this?

Reply With Quote
 
  #8 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received


NinjaStrategies View Post
Can you give me a direction howto add this?

CancelAllOrders(true, true);

Reply With Quote

Reply



futures io > > > > > CancelOrder on multiple contracts

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
More Contracts = Less Risk hondo69 Psychology and Money Management 27 October 25th, 2014 12:07 PM
Number of ES futures contracts? bearsden Psychology and Money Management 10 May 31st, 2014 08:02 AM
Sierra Chart continuous contracts Big Mike Sierra Chart 4 September 16th, 2011 01:33 AM
is there a way to see how many contracts are long and how ma trader1512 Traders Hideout 3 April 18th, 2010 02:45 PM
ES or DOW contracts tellytub Traders Hideout 3 October 15th, 2009 09:16 AM


All times are GMT -4. The time now is 02:19 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-14 in 0.10 seconds with 20 queries on phoenix via your IP 54.221.76.68