Flatten All Positions - NinjaTrader Programming | futures io social day trading
futures io futures trading


Flatten All Positions
Updated: Views / Replies:8,490 / 11
Created: by togier 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
 

Flatten All Positions

  #1 (permalink)
Elite Member
Boston, MA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB
Favorite Futures: EUR/USD
 
Posts: 42 since Apr 2010
Thanks: 1 given, 3 received

Flatten All Positions

Does anyone know the syntax for flatten all positions at a particular time? Can't find it in the help. Thanks.

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,068 received



togier View Post
Does anyone know the syntax for flatten all positions at a particular time? Can't find it in the help. Thanks.

There are two ways:

1) Close At Time is a strategy that will automatically close your position at a user defined time. A position will be closed using the NinjaTrader close algorithm. The user defined close time can be set via the "Time to flatten" property located in the Misc tab. You can enable or disable this strategy via any NinjaTrader order entry screen's right mouse click context menu.

2) You build a strategy with the following commands:

if (ToTime(Time[0]) > Starttime)
{
ExitTypeofEntry(""
); 
}


Last edited by redratsal; February 14th, 2011 at 09:39 AM.
Reply With Quote
 
  #4 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,255 received

An example

This will close your positions at 4:00pm

 
Code
                            
if (ToTime(Time[0]) >= 160000)

{
   if (
Position.MarketPosition == MarketPosition.Long)
      
ExitLong();
   else if (
Position.MarketPosition == MarketPosition.Short)
      
ExitShort();


Reply With Quote
The following user says Thank You to shodson for this post:
 
  #5 (permalink)
Elite Member
Germany / Italy
 
Futures Experience: Advanced
Platform: a few...
Favorite Futures: all that move nicely, extend your horizons
 
Posts: 67 since Nov 2009
Thanks: 45 given, 31 received

while completely unsupported by the nt folks, you can try calling

 
Code
NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything()
at your desired Time[x].

Beware though it's not limited to a specific symbol or account

Reply With Quote
The following user says Thank You to wavey for this post:
 
  #6 (permalink)
Elite Member
Denver, CO
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NinjaTrader Brokerage
Favorite Futures: ES
 
NinjaTrader's Avatar
 
Posts: 1,260 since May 2010
Thanks: 153 given, 1,890 received


wavey View Post
while completely unsupported by the nt folks, you can try calling

 
Code
NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything()
at your desired Time[x].

Beware though it's not limited to a specific symbol or account

Correct, this is not supported and it's internal implementation can change at any time. That being said, this method will do the following as of this post:

- Cycle through each open connection
- Cycle through each account within the connection
- Terminate any running strategies on the account
- Cancel any active orders on the account
- Close any open position on the account

Reply With Quote
The following user says Thank You to NinjaTrader for this post:
 
  #7 (permalink)
Trading Apprentice
Raleigh, NC
 
Futures Experience: Master
Platform: NinjaTrader, custom built
Broker/Data: Direct Market Access
Favorite Futures: ES 6E, CL, GC, ZN
 
Posts: 3 since Jun 2010
Thanks: 0 given, 2 received

In my experience FlattenEverything works great.

Reply With Quote
The following user says Thank You to ScottB for this post:
 
  #8 (permalink)
Elite Member
Prague
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: 6E,TF, CL
 
Merlin997's Avatar
 
Posts: 14 since May 2011
Thanks: 26 given, 2 received


ScottB View Post
In my experience FlattenEverything works great.

Is possible to call
NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything();
without strategy termination?

regards

Tomas

Reply With Quote
The following user says Thank You to Merlin997 for this post:
 
  #9 (permalink)
Trading Apprentice
Raleigh, NC
 
Futures Experience: Master
Platform: NinjaTrader, custom built
Broker/Data: Direct Market Access
Favorite Futures: ES 6E, CL, GC, ZN
 
Posts: 3 since Jun 2010
Thanks: 0 given, 2 received

To the best of my knowledge, FlattenEverything() will stop the strategy. I only use it for error conditions.

Best Regards,
Scott

Reply With Quote
The following user says Thank You to ScottB for this post:
 
  #10 (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,240 since Jun 2009
Thanks: 29,353 given, 83,234 received


 
Thread Moved


Moved to NinjaTrader Programming

(better late than never)



When creating a new thread, note which subforum you are in. Here is a short list of suggestions:

- Topic: Anything to do with an Elite indicator -> Subforum: The Elite Circle
- Topic: Looking for an existing indicator, or how-to use an indicator -> Subforum: (the platform)
- Topic: Programmer needing help with non-Elite indicator -> Subforum: (the platform) - Programming
- Topic: Want an indicator created/modified -> Reply to "Want indicator created free" in Elite Circle
- Topic: Vendors (trading rooms, commercial indicators) -> Subforum: Vendors/Product Reviews
- Topic: Discussion of Forex or Currency trading -> Subforum: Forex and Currency Trading
- Topic: Journals of your trading -> Subforum: Trading Journals or Elite Trading Journals
- Topic: General trading related discussions -> Subforum: Traders Hideout
- Topic: Discussion of a trading method -> Subforum: Traders Hideout
- Topic: Automated Trading -> Subforum: Elite Automated Trading

Last, any Elite Member may create more or less any of these topics in The Elite Circle at your own discretion (your support is appreciated).

This is just a short general list and doesn't cover everything. If you are unsure where to create your new thread, just create it in Traders Hideout and a moderator will move it if necessary.

-- Big Mike Trading


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:

Reply



futures io > > > > > Flatten All Positions

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
Closing positions problem zury IB Trader Workstation 1 June 9th, 2011 01:29 PM
Half Of The Major Financial Regulatory Positions not filled kbit News and Current Events 0 May 19th, 2011 08:50 PM
Flatten All ? phyzfer NinjaTrader Programming 12 April 30th, 2011 12:37 PM
Account position: How to differentiate positions arjfca The Elite Circle 5 February 5th, 2011 03:27 PM


All times are GMT -4. The time now is 04:24 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-15 in 0.12 seconds with 37 queries on phoenix via your IP 54.234.255.29