• 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, 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 ct, Today, 08:13 PM
    0 responses
    4 views
    0 likes
    Last Post ct
    by ct
     
    Started by Lumbeezl, Today, 05:17 PM
    0 responses
    6 views
    0 likes
    Last Post Lumbeezl  
    Started by wishing, Today, 03:33 PM
    0 responses
    10 views
    0 likes
    Last Post wishing
    by wishing
     
    Started by ATMtrader0001, Today, 01:48 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by RandanAL, Yesterday, 05:13 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X