Flatten all trades NT8 help - NinjaTrader Programming | futures io social day trading
futures io futures trading


Flatten all trades NT8 help
Updated: Views / Replies:196 / 1
Created: by ElBi 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 trades NT8 help

  #1 (permalink)
Elite Member
North Bergen
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Cl, ZB
 
Posts: 4 since Feb 2017
Thanks: 2 given, 0 received

Flatten all trades NT8 help

Good afternoon all.

I looked around and am trying to set a strategy that oversees the account and closes out and disables all the strategies I have on my account when I reach a 1000 profit target or a 870 loss.

 
Code
NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything()
does not work on NT8.

Here is my code:

 
Code
myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101");

 
Code
if (myAccount.Get(AccountItem.UnrealizedProfitLoss, Currency.UsDollar) >= 1000 )
{
	 Account.FlattenEverything();
			
	Print("1000 hit PnL: " + myAccount.Get(AccountItem.UnrealizedProfitLoss, Currency.UsDollar) + " " + Times[0][0].TimeOfDay);
		
				
} 
			

			
			
if (myAccount.Get(AccountItem.UnrealizedProfitLoss, Currency.UsDollar) <= -870)
 {
	 Account.FlattenEverything(); 
				

	Print("-870 hit PnL: " + myAccount.Get(AccountItem.UnrealizedProfitLoss, Currency.UsDollar)+ " @ " + Times[0][0].TimeOfDay);
		   
		
} //END OF DD CLOSE CHECK!
			

if ((Times[0][0].DayOfWeek == DayOfWeek.Friday) && (Times[0][0].TimeOfDay >= new TimeSpan(16, 40, 0)))
{
	Account.FlattenEverything();
} //END OF FRIDAY EXIT A FEW MINS BEFORE CLOSE

As soon as I enable this, it disables all the strategies. Is there something I missed in the "If" statements?

Thank you!!

Solution:

Turnes out that if you use
 
Code
Times[0][0].
it goes thru all the bars on the chart and sure enough, there were two Friday 16:40 bars on the chart.

Correction:

Use
 
Code
DateTime.Now
and it will only check future bars.

Thanks for your time!! Hope someone will learn from my blunders!


Last edited by ElBi; May 1st, 2017 at 09:49 PM. Reason: added myAccount info - Solved
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.


Reply



futures io > > > > > Flatten all trades NT8 help

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
Who has switched to NT8? Who still trades on NT7? BarefootHank2017 NinjaTrader 29 March 27th, 2017 07:51 AM
Good trades, bad trades, winning trades & losing trades AsymOlly Trading Journals 42 July 11th, 2016 11:08 AM
Flatten Strategy? SirPsycho ThinkOrSwim 4 January 11th, 2013 08:48 PM
Flatten All Positions togier NinjaTrader Programming 11 October 13th, 2012 02:55 AM
Flatten All ? phyzfer NinjaTrader Programming 12 April 30th, 2011 12:37 PM


All times are GMT -4. The time now is 07:18 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-13 in 0.07 seconds with 19 queries on phoenix via your IP 54.196.182.102