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

session[0]<>session[1]....how code it?

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

    session[0]<>session[1]....how code it?

    hi,


    This session is different of previous session? ....



    i would to code it..

    #2
    Hello esignal,

    Thanks for your post.

    To detect if you are entering a new session you can check to see if (Bars.IsFirstBarOfSession) is true. Reference: http://ninjatrader.com/support/helpG...rofsession.htm

    For other questions regarding the session, please see the available methods and properties of the session Iterator in the helpguide here: http://ninjatrader.com/support/helpG...oniterator.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      If use chart daily it don't run...
      I want a code that run correctly in chart intraday and in chart daily
      Last edited by esignal; 09-22-2017, 07:01 AM.

      Comment


        #4
        Hello esignal,

        Thanks for your reply.

        Can you elaborate with further detail so I can better understand what you are trying to accomplish. Also what Calculate mode are you using?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Onbarclose

          Comment


            #6
            Hello esignal,

            Thanks for your reply.

            Using OnBarClose mode with daily bars means you will not know of the forming bar until it closes.
            If you are trying to detect the newly forming day bar then you would need to use Calculate.OnEachTick and in this mode Close[0] would be the current price and Close[1] would be yesterdays close (when using daily bars). You could also use Calculate.OnPriceChange which only runs OBU when price changes so would not update OBU as frequently as OnEachTick

            If you have code that you only want to run once per bar you can use those modes and segment your code based on the bool IsFirstTickOfBar. You can review a reference sample here: http://ninjatrader.com/support/forum...ad.php?t=19387
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by maybeimnotrader, Yesterday, 05:46 PM
            4 responses
            23 views
            0 likes
            Last Post maybeimnotrader  
            Started by frankthearm, Today, 09:08 AM
            6 responses
            25 views
            0 likes
            Last Post frankthearm  
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            33 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            7 responses
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by merzo, 06-25-2023, 02:19 AM
            10 responses
            824 views
            1 like
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X