• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 01: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 bebbus, Today, 04:03 PM
    2 responses
    5 views
    0 likes
    Last Post bltdavid  
    Started by Unicorn_Catcher, Today, 04:06 PM
    1 response
    5 views
    0 likes
    Last Post User1104  
    Started by punkiy2111, Today, 04:02 PM
    2 responses
    3 views
    0 likes
    Last Post punkiy2111  
    Started by traderharley, Today, 03:32 PM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by yrch1985, Today, 02:04 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X