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 frandepaulapr, Today, 04:14 AM
    0 responses
    5 views
    0 likes
    Last Post frandepaulapr  
    Started by ThePicsou, 07-22-2024, 11:36 AM
    4 responses
    30 views
    0 likes
    Last Post ThePicsou  
    Started by marco231, 03-20-2024, 03:56 PM
    7 responses
    176 views
    0 likes
    Last Post marco231  
    Started by Irukandji, 04-22-2024, 04:33 AM
    7 responses
    37 views
    0 likes
    Last Post Irukandji  
    Started by Irukandji, Today, 01:56 AM
    0 responses
    6 views
    0 likes
    Last Post Irukandji  
    Working...
    X