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

exit on close on weekend

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

    exit on close on weekend

    I had two questions regarding Exit on Close. Suppose I want to ES (e-mini) which trade nearly 24 hours.

    1. If I have ExitOnClose = true in my strategy code, would the strategy close at NY time 16:15 EST, and reopen at NY time 16:30 EST when the contract starts trading on Globex, OR does it close at NY time 16:15 EST and reopens at NY time 8:30 EST?

    2. Suppose I want to do ExitOnClose =true only on the weekend, i.e. 16:15 EST on Friday (or Thursday if Friday is a holiday, or Wednesday if both Thursday and Friday are holdidays) and want the strategy to start again at 6:00 pm EST NY on Sunday.

    More specifically, in general, I want to implement ExitOnClose such that it does an ExitOnClose for the weekend - not just for ES, but also for other markets such as CL (Crude) - while also recognizing holiday schedules. How can I implement / code this?

    #2
    Hello uday12,

    Thanks for your post.

    The answer to all of the questions you have asked are depending on the session template in use for the instrument. The session template is what has the hours listed and would be what ExitOnClose uses to know when the end of session time is. Here is the helpguide definition of session template:

    Session Templates
    A Session Template is a collection of session definitions that can be used anywhere NinjaTrader utilizes data. (See the "Where Session Templates can be Applied" sub-section below). When a template is applied, any data outside of the times in the session definitions will be ignored. NinjaTrader comes pre-loaded with the most common Session Templates; however, custom Session Templates can also be created to suit your needs.


    Here is a link to the helpguide on the session manager: http://ninjatrader.com/support/helpG...on_manager.htm

    To be clear, ExitOnClose means that any open position, in that strategy, will be closed at the time specified as the end of session minus the exitonclose seconds. You strategy would continue running and if coded to would place orders when the next session opens (or thereafter).

    Note that in addition to using the session template you can always code time constraints directly with in your code, here is our reference sample for that: http://ninjatrader.com/support/forum...ead.php?t=3226
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    938 views
    0 likes
    Last Post spwizard  
    Started by Max238, Today, 01:28 AM
    0 responses
    3 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by rocketman7, Today, 01:00 AM
    0 responses
    2 views
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Working...
    X