Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Perr0Grande, Today, 08:16 PM
    0 responses
    2 views
    0 likes
    Last Post Perr0Grande  
    Started by elderan, Today, 08:03 PM
    0 responses
    5 views
    0 likes
    Last Post elderan
    by elderan
     
    Started by algospoke, Today, 06:40 PM
    0 responses
    10 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    12 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    7 views
    0 likes
    Last Post quantismo  
    Working...
    X