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

Showing Inside/Outside Vertcal bar formation on chart

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

    Showing Inside/Outside Vertcal bar formation on chart

    I am trying to show where the inside and outside vertical bars occur on my charts but it will not display. I would like to display a simple text of "IVB" or "OVB" display above the bar when it occurs. I am not sure why it is not displaying. Can you guide me?

    if (High[0] > High[1] && Low[0] < Low[1]) // Outside vertical bar
    DrawText(Convert.ToString(CurrentBar+"OVB"), "OVB", 0, High[0] + (8*TickSize), Color.Red);

    if (High[0] < High[1] && Low[0] > Low[1]) // Inside vertical bar
    DrawText(Convert.ToString(CurrentBar+"IVB"), "IVB", 0, High[0] + (8*TickSize), Color.Red);

    Thank you.

    #2
    Hello MiamiTom,

    The logic looks good. Check the log tab of the control center for any error messages.

    You may be running into this issue here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Receive error as follows:

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

      Comment


        #4
        Yes, that would be the issue described in Make sure you have enough bars in the data series you are accessing.


        Add the lines below in your OnBarUpdate() block and it should resolve for you:

        if (CurrentBar < 1)
        return;
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Not sure why this works but it did. Text now showing.

          Thank you very much.

          Comment


            #6
            Glad that did the trick for you. Thanks for the update.

            The [1] index value does not exist when attempting to access from the first bar in the series. The statement you added tells NinjaTrader not to process the indicator logic for this first bar.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by traderqz, Today, 12:06 AM
            3 responses
            5 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by RideMe, 04-07-2024, 04:54 PM
            5 responses
            28 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by f.saeidi, Today, 08:13 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DavidHP, Today, 07:56 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by kujista, Today, 06:23 AM
            3 responses
            11 views
            0 likes
            Last Post kujista
            by kujista
             
            Working...
            X