Flatten All Positions (Page 2) - NinjaTrader Programming | futures.io
futures.io futures trading

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Flatten All Positions
Started:February 13th, 2011 (05:05 PM) by togier Views / Replies:6,773 / 11
Last Reply:October 13th, 2012 (01:55 AM) Attachments:0

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Flatten All Positions

Old October 18th, 2011, 08:23 PM   #11 (permalink)
Elite Member
Lagos, Nigeria
Futures Experience: Intermediate
Platform: NinjaTrader, SierraChart
Favorite Futures: Euro Currency & Oil
lolu's Avatar
Posts: 2,435 since Jun 2009
Thanks: 997 given, 1,590 received

NinjaTrader View Post
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

Is there a ChartTrader equivalent of "NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything()", and which is not a Strategy command call but a command call within an indicator script, even if unsupported ? A kinda "NinjaTrader.Gui.Chart.Chart.FlattenEverything()". Or, better still ..... what is the command script for the ChartTrader "Close" button trigger ?


Reply With Quote

Old October 13th, 2012, 01:55 AM   #12 (permalink)
Elite Member
Charlotte, NC/USA
Futures Experience: Advanced
Platform: NT, TOS
Broker/Data: Mirus/ZF, AMP/CQG, TOS, MBT
Favorite Futures: Futures, Stocks, Bonds, Forex
Posts: 36 since May 2011
Thanks: 56 given, 9 received

Strategy Time to exit all positions but leave in running...

shodson View Post
This will close your positions at 4:00pm

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

   if (
Position.MarketPosition == MarketPosition.Long)
   else if (
Position.MarketPosition == MarketPosition.Short)

If I implement this in a strategy, will it exit at a particular time in that Strategy and still allow it to run (the strategy)? Also, if I left the NT Flatten positions option checked (as a backup) to exit as well, will that still allow the strategy to keep running? Or, should one just use the above code in the Strategy and uncheck the NT Flatten positions? My goal is to close shortly before 4 pm est (say 30 seconds to a min before) and then have the strategy keep running but start back trading after 7 pm est. I already have the code for the time frames to enter the trades working perfectly...I just need it to exit at a certain time without turning off the Strategy...thank folks!

Reply With Quote


futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Flatten All Positions

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing positions problem zury IB Trader Workstation 1 June 9th, 2011 12:29 PM
Half Of The Major Financial Regulatory Positions not filled kbit News and Current Events 0 May 19th, 2011 07:50 PM
Flatten All ? phyzfer NinjaTrader Programming 12 April 30th, 2011 11:37 AM
Account position: How to differentiate positions arjfca The Elite Circle 5 February 5th, 2011 02:27 PM

All times are GMT -4. The time now is 04:58 AM.

Copyright © 2016 by 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 2016-10-27 in 0.06 seconds with 23 queries on phoenix via your IP