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

DrawDot for Inside Bar

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

    DrawDot for Inside Bar

    Hi,
    Just started NinjaScripting. Experimenting with indicator dev. for InsideBar, but its not plotting desired dots when i employ on charts, strangly when i dev. a simple Strategy via wizard for same then dots were plotting. Copying the code from strategy to indicator also didnt help with indicator.
    Also , why strategy wizard adds 'CurrentBar' with tag...

    Devdas
    NinjaTrader Ecosystem Vendor - Devdas

    #2
    Hello,

    Just started NinjaScripting. Experimenting with indicator dev. for InsideBar, but its not plotting desired dots when i employ on charts, strangly when i dev. a simple Strategy via wizard for same then dots were plotting.
    >>I am sorry, what do you want the indicator to do exactly? Draw a dot based on what exactly? ("Inside bar" is defined different for different traders.)

    Copying the code from strategy to indicator also didnt help with indicator.
    >>This usually only works for small snippets. It is best just to start over with the indicator.

    Also , why strategy wizard adds 'CurrentBar' with tag
    >>The Wizard is adding the current bar number (which increases from left to right on your chart) to the tag to give you a unique name that will not repeat and mess up your other dots:
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      I am sorry, what do you want the indicator to do exactly? Draw a dot based on what exactly? ("Inside bar" is defined different for different traders.)
      I want indicator to plot a dot above the bar , which meets the condition,

      (High[0] < High[1]) && (Low[0] > Low[1])
      Devdas
      NinjaTrader Ecosystem Vendor - Devdas

      Comment


        #4
        Hi,
        i resolved the problem, as looked in to Log for error which was as

        Error on calling the 'OnBarUpdate' method for indicator 'InsideBar' on bar 0: Index was out of range. Must be non-negative and less than the size of the collection.

        So appplied solution as given in thread





        and that resulted in desired action...



        But now im more curious about behaviour of 'CurrentBar' term...why indicator failed to produce in absence of that line while data series contain thousands of data line....
        Please suggest more information source about 'CurrentBar' nature and example.
        Devdas
        NinjaTrader Ecosystem Vendor - Devdas

        Comment


          #5
          Hi devdas, maybe I can help while support is helping others. The reason the code didn't work before is because you are try to get a value from a bar that doesn't yet exist.

          (High[0] < High[1]) && (Low[0] > Low[1])

          You reference High[1] and Low[1] which are not there when the indicator starts and is on bar 0.
          eDanny
          NinjaTrader Ecosystem Vendor - Integrity Traders

          Comment


            #6
            Originally posted by eDanny View Post
            Hi devdas, maybe I can help while support is helping others. The reason the code didn't work before is because you are try to get a value from a bar that doesn't yet exist.

            (High[0] < High[1]) && (Low[0] > Low[1])

            You reference High[1] and Low[1] which are not there when the indicator starts and is on bar 0.
            Yes, i already got this point, but it means first failure on bar 0, is cause for total drop of indicator plot... ...
            Devdas
            NinjaTrader Ecosystem Vendor - Devdas

            Comment


              #7
              Hello Devdas,

              Originally posted by devdas View Post
              Yes, i already got this point, but it means first failure on bar 0, is cause for total drop of indicator plot... ...
              Yes, this is true. For more information read the article below:
              Make sure you have enough bars in the data series you're accessing.
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by sidlercom80, 10-28-2023, 08:49 AM
              172 responses
              2,278 views
              0 likes
              Last Post sidlercom80  
              Started by Irukandji, Yesterday, 02:53 AM
              2 responses
              17 views
              0 likes
              Last Post Irukandji  
              Started by adeelshahzad, Today, 03:54 AM
              0 responses
              3 views
              0 likes
              Last Post adeelshahzad  
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              3 views
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Working...
              X