Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't find a way to exit EOD properly

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

    Can't find a way to exit EOD properly

    I'm having a real challenge effecting EOD exits, along with a related challenge in that when I start my strategy in the middle of the day the strategy position won't let me start taking trades as early as it might otherwise.

    I first tried using the built-in Exit On Close functionality, but after much back and forth with support, it was suggested I don't use this means to exit end of day.

    So, I employed this:

    // exit EOD
    if(ToTime(Time[0])>=eodExitTime)
    {
    ExitShort();
    }

    But, as soon as I tested it, I realized there would be a problem because I run Range bars of various sizes. This means that, given a range bar of just the right size, the time spanned from bar start to bar end would contain my eodExitTime. In turn, that means that when loading the strategy, the historical bars would still cause a Strategy Position to exist at end of day (becuase on historical data the strategy doesn't calculate until end of bar and there is no next bar's first tick to trigger the onBarUpdate), which then screws up the ability to properly enter at the start of the next day.

    So then, I thought, aha! Let's just put in If(Historical)return;
    But, alas, that doesn't work either, because according to Ninja documentation, Historical will return True until the virtual position is flat.

    So, how can I effect and EOD exit that consistently works using Range bars?

    #2
    Hi coolmoss,

    I believe if (Historical) return; will work for you to submit live orders as soon as you want. Yes, this property will return true when you are in a virtual position and are in "waiting until flat" mode.

    However, if you use if (Historical) return; in your strategy, then it's impossible to have a virtual historical position. Your strategy will then always submit the first live entry orders that it processes.
    Last edited by NinjaTrader_RyanM1; 04-12-2012, 07:52 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      That would be fantastic news for me. Thanks for the info, will try it out and see what happens.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      574 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X