Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conditional and Partial Exit End of Day

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Conditional and Partial Exit End of Day

    Hi Guys,

    I understand that if I want to be flat at the end of the day I can place the following in my Script.
    ExitOnClose = true;

    My problem is that I want to be flat at the end of the day if certain conditions are met, otherwise I would only like to exit part of the position at the end of the day.

    Sadly, because of NT's defective CEP if I use the following condition NT doesn't exit until the following open, which is not what I want.
    if (BarsArray[0].LastBarOfSession)
    ExitLong...

    What I'm trying to avoid is having to put the session close times for every market into the script to compensate for this crippling limitation. Any ideas? Does NT8 handle this better?

    Is there a way to enquire about the "SecondLastBarOfSession" as NT seems unable to execute an action on the same bar the event occurs? Once again, is this something NT8 does?
    Last edited by Aspirant; 10-01-2015, 02:54 PM.

    #2
    Hello Aspirant,

    I'm not quite sure what you are referring to as CEP. Can you detail what this is any why you think this is defective.

    You are correct, the last bar on a chart will not close until there is a tick to open the new bar. So the last bar of the session will not close until the new session opens. This is by design.

    Bars.LastBarOfSession is not documented and was not meant to be used in a script, but I can look further into this and see how this should be used if you like.

    As far as making sure you are flat at the end of the day, I would suggest using the Bars.Session.NextEndTime in a strategy that runs on each tick. If the time is approaching the end of your session manage your orders as you like. Flatten or scale out as you please.
    http://ninjatrader.com/support/helpG...t7/session.htm
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X