Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

xvalue error

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

    xvalue error

    The following line of code is producing a negative value of xvalue is this possible or an error?

    double xvalue = chartControl.GetXByBarIndex(ChartBars, idx);

    So for example
    int idx = 22861
    double xvalue = -15929


    #2
    Hello, thanks for writing in.

    You must make sure the index is displayed on the render view. Most will use the FromIndex and ToIndex to iterate through all the visible bars:
    https://ninjatrader.com/support/help..._fromindex.htm

    It's returning a negative number because this bar index is lower on the X axis of the render view.

    Best regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello, thanks for writing in.

      You must make sure the index is displayed on the render view. Most will use the FromIndex and ToIndex to iterate through all the visible bars:
      https://ninjatrader.com/support/help..._fromindex.htm

      It's returning a negative number because this bar index is lower on the X axis of the render view.

      Best regards,
      -ChrisL
      Thanks for your reply. The issue seems to occur when I add an additional timeframe to the strategy doing the rendering The additional timeframe is not used for plottting )

      else if (State == State.Configure)
      {
      Signals = new ConcurrentBag<Signal>();

      //three renko ES chart
      AddDataSeries("ES 06-21", new BarsPeriod() { BarsPeriodType = (BarsPeriodType)12345, Value = 3, Value2 = 1 });
      }

      Are there possible issues with OnRender() with multitimeframes? I wish to plot based on the base timeframe (BarsinProgress==0)



      Comment


        #4
        Hello, thanks for your reply.

        The ChartBars object is the primary bars series, so the second time frame should not have an effect on this. GetXByBarIndex will return negative values if the bar index is not visible on the chart at the time it is called.

        Best regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timmbbo, Today, 09:10 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by space_trader, 11-26-2020, 05:06 AM
        2 responses
        164 views
        1 like
        Last Post klaus w
        by klaus w
         
        Started by Kicks.Spin, Today, 07:46 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by Renejm, Today, 06:17 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by kazisl, Yesterday, 06:41 PM
        3 responses
        15 views
        0 likes
        Last Post kazisl
        by kazisl
         
        Working...
        X