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 Waxavi, Today, 02:00 AM
            0 responses
            1 view
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by elirion, Today, 01:36 AM
            0 responses
            3 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            4 views
            0 likes
            Last Post gentlebenthebear  
            Started by samish18, Yesterday, 08:31 AM
            2 responses
            9 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by Mestor, 03-10-2023, 01:50 AM
            16 responses
            391 views
            0 likes
            Last Post z.franck  
            Working...
            X