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

Historical is a liar

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

    Historical is a liar

    Historical returns true when using Zen-Fire demo connection in real-time. Why is that?

    Until now, I have managed to get a false out of it only by using the Market Replay and deleting data history prior to the stream.

    #2
    Do you test from an indicator or strategy?

    Single series or MultiSeries setup?

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Single series indicator.

      I put the if (Historical) return; at the OBU so when I load the indicator it won't have to iterate all existing bars and instead it will call OBU at each close of a present bar.

      Comment


        #4
        Originally posted by savekad View Post
        Single series indicator.

        I put the if (Historical) return; at the OBU so when I load the indicator it won't have to iterate all existing bars and instead it will call OBU at each close of a present bar.
        Correct, this would then call OBU only on realtime bars as it returns out on historical ones.

        How do you check for the historical condition in your code?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          OnBarUpdate()
          {
          if (Historical)
          {
          ClearOutputWindow();
          Print("Historical data found.");
          return;
          }
          *rest of the code*
          }

          Comment


            #6
            You will see then prints for Historical data of course with this setup. As the OnBarUpdate() runs through the historical chart portion as well before hitting live data.

            Try something like -

            if (Historical)
            return;

            Print(Historical);
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Of course. The thing is that when reaching the real-time bar, it keeps printing and it doesn't executes the code. I waited more for than 3 new bars to be created.

              Comment


                #8
                So what does it print then? True or false?
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Damn...

                  Never mind, you were right. It's working now.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by rdtdale, Today, 01:02 PM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_LuisH  
                  Started by alifarahani, Today, 09:40 AM
                  3 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by RookieTrader, Today, 09:37 AM
                  4 responses
                  18 views
                  0 likes
                  Last Post RookieTrader  
                  Started by PaulMohn, Today, 12:36 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post PaulMohn  
                  Started by love2code2trade, 04-17-2024, 01:45 PM
                  4 responses
                  41 views
                  0 likes
                  Last Post love2code2trade  
                  Working...
                  X