Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trigger Event Before Close

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

    Trigger Event Before Close

    Is there a way to trigger an event prior to the market close? For instance, some way to schedule an event for a particular time. Since my strategies are based on range bars, it could be 5 minutes... or 1 hour before the next bar executes. So I can not put my end of day logic in the OnBar method.

    I need some way to trigger the strategy so that if I have an open position, I will close it and cancel any pending orders. Several times per week I seem to end up with "phantom" positions. Appears to be related to using the Close positions on Session close functionality. The strategy is not aware that the position was closed, and I end up with phantom positions opening when it thinks it is closing a position.

    To avoid this, I rather just get a callback in my strategy so that I can close and cleanup. Thoughts?

    #2
    frostengine, with DateTime.Now you can just access the PC's current realtime clock and do your end of day processing then when this hits your desired timepoint before the session would end.

    For the default ExitOnClose, please ensure the seconds setting is high enough to process the closing / filling of orders and allowing for a tick to happen to trigger the exit behavior.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X