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

2 Questions

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

    2 Questions

    I have a question with regards to how the strategy session time works. If I have a session start at 8:30 on the 3 minute time frame, and I call the Close[1] right at the start, will the strategy see the 8:27 bar or the bar from the previous session? If I set it to 8:30-15:00, would it use the 15:00 bar for the Close[1]?

    Also, if I have strategy A that has an Open position and calls a helper method in strategy B, and strategy B calls MarketPosition.Position == Position.Flat, will it see the position as flat or would it recognize the open position and act accordingly?

    Thanks

    #2
    On the close of the 8:33 bar (1st bar of the session), Close[1] will return the last bar of the prior session. If you session time ended at 3:15 PM, it would reference the last bar of around that time.

    Position only returns the position of that strategy, not the underlying account.
    RayNinjaTrader Customer Service

    Comment


      #3
      So in order to avoid using the bar from the previous session, I need to do something like
      if (Bars.BarsSinceSession > 1){return;}?

      Comment


        #4
        Yes, that approach would work.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Barry Milan, Yesterday, 10:35 PM
        5 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        13 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        12 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        8 views
        0 likes
        Last Post nandhumca  
        Working...
        X