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

How to deal with the 'Session breaks'/'Multiple sessions' in a trading day ?

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

    How to deal with the 'Session breaks'/'Multiple sessions' in a trading day ?

    Hi

    I have developed a range break-out strategy for NT-7. It forms a range for the day during early market hours i.e. from MOT (Market open time) to n1 minutes after MOT. After forming the range it moves on to signal generation & execution part.

    It starts signal generation & execution n1 minutes after, from the MOT(Market open time) & it stops signal generation n2 minutes before to the MCT(Market close time). In this strategy I'm retrieving MOT & MCT using following NinjaScript function:
    //Set Market Open Time & Market Close Time for given time
    Bars.Session.GetNextBeginEnd(Time[0], out CurrentDayMOT, out CurrentDayMCT);

    When I back-test this strategy on US stock AAPL it works perfectly as I expected, it returned MOT = 09:30 AM & MCT = 04:00 PM. As there is only single session for a trading day in Session Template 'US Equities RTH'.




    But When I test it for the HKEx futures HHI(H-shares Index Futures) using Session Template 'HKFE New'. it went totally wrong. Here I was expecting MOT = 09:15 AM & MCT = 04:15 PM for current trading day, but Ninjascript returned MOT = 09:15 AM & MCT = 12:00 PM for 1st Session of the day after the Session break(12:00 PM to 1:30 PM) it returned MOT = 01:30 PM & MCT = 04:15 PM for 2nd Session.



    Due to this behavior
    I got two different ranges whether I was expecting only one range for that day.
    Also it stopped generating signal n2 minutes before to 'End time' of 1st session and started it again n1 minutes after from 'Start time' of 2nd session which I didn't expected


    So, How do I set MOT = 09:15 AM ('Strat time' of 1st session) & MCT = 04:15 PM ('End time' of 2nd session) in above discussed Multiple session case ?

    #2
    Hi there, the easiest way to do this would be to just create a new session template that doesn't include the break in the middle of the day. Please let me know if you have any other questions.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks Austin

      It works now. but; Is there another way to detect 'session breaks' or 'Multiple sessions' through strategy itself ?

      Comment


        #4
        Hello,

        Unfortunately there would not be another way to detect this. As NInjaTrader does not support multiple sessions in the same day at this time unfortunately. Only way to do it would be with a time filter with a session template that is open through the day.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sdauteuil, 09-23-2021, 10:16 AM
        7 responses
        1,246 views
        0 likes
        Last Post marcus2300  
        Started by sofortune, 05-18-2024, 11:48 AM
        2 responses
        32 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Zach55, 02-19-2024, 07:22 PM
        2 responses
        65 views
        0 likes
        Last Post lbadisa1  
        Started by JGriff5646, Yesterday, 05:47 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by AlphaOptions, 06-18-2013, 08:24 AM
        9 responses
        2,203 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X