NexusFi: Find Your Edge


Home Menu

 





Flatten All Positions


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ScottB with 2 posts (2 thanks)
    2. looks_two Big Mike with 1 posts (1 thanks)
    3. looks_3 lolu with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one ScottB with 1 thanks per post
    2. looks_two Big Mike with 1 thanks per post
    3. looks_3 wavey with 1 thanks per post
    4. looks_4 shodson with 1 thanks per post
    1. trending_up 14,977 views
    2. thumb_up 7 thanks given
    3. group 8 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

Flatten All Positions

  #11 (permalink)
 
lolu's Avatar
 lolu 
Lagos, Nigeria
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader, SierraChart
Trading: Euro Currency & Oil
Frequency: Daily
Duration: Hours
Posts: 2,552 since Jun 2009
Thanks Given: 1,049
Thanks Received: 1,678


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 ?

Lolu

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
About a successful futures trader who didnĀ“t know anyth …
Psychology and Money Management
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #12 (permalink)
 birdoggg 
Charlotte, NC/USA
 
Experience: Advanced
Platform: NT, TOS
Broker: Mirus/ZF, AMP/CQG, TOS, MBT
Trading: Futures, Stocks, Bonds, Forex
Posts: 37 since May 2011
Thanks Given: 56
Thanks Received: 9


shodson View Post
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();


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




Last Updated on October 13, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts