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

Error on plotting last value for indicator

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

    Error on plotting last value for indicator

    Hi,

    the following error message is written into to the control center log (category 'Default') in conjunction with market replay:

    Error on plotting last value for indicator 'MACD'. Please check the 'OnBarUpdate' method: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    I use a strategy with the following contents:

    Code:
    [FONT=Courier New][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New] Initialize()[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]Add(MACD([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New]));[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]CalculateOnBarClose = [/FONT][/SIZE][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][SIZE=2][FONT=Courier New];[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
     
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New] OnBarUpdate()[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (CurrentBar <= [/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New];[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
    [/FONT]
    Nothing else. NT version is 6.5.1000.7

    Following steps are done:
    - Start replay connection (recorded some hours of tick data in advance).
    - Open a new 150-tick-chart and apply this test stratey
    - Start replay with speed 100x and wait until the MACD starts to operate
    - Stop replay
    - Drag the replay slider back into its initial position, this is causing that error message. At the next run the MACD doesn't show up anymore.

    Regards
    Ralph

    #2
    Ralph,

    Try just throwing the MACD onto the chart without the strategy and running again. See if the MACD alone gives you errors.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Your suspicion is correct, Josh. Also without the strategy loaded but just the MACD causes this error message to occure. Have to point out that this happens only when dragging the slider back to its zero-position. As long as I restart with just a single bar left on the chart, it works fine.

      Regard
      Ralph

      Comment


        #4
        If you could mail us your market replay files that would be great. Please send a note to josh [dot] peng [at] ninjatrader [dot] com and mention this thread. Thanks.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          This is a bug which will be fixed with next update. Thanks for reporting.

          Comment


            #6
            Many thanks to the NT-team.

            Here is a "nice to have" for the market replay: A single-step-button which advances one single bar or tick, would be a nice debugging aid.

            Regards
            Ralph

            Comment


              #7
              Ralph,

              Thank you for the suggestion. We will add it to the list of future considerations.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Balage0922, Today, 07:38 AM
              0 responses
              1 view
              0 likes
              Last Post Balage0922  
              Started by JoMoon2024, Today, 06:56 AM
              0 responses
              6 views
              0 likes
              Last Post JoMoon2024  
              Started by Haiasi, 04-25-2024, 06:53 PM
              2 responses
              19 views
              0 likes
              Last Post Massinisa  
              Started by Creamers, Today, 05:32 AM
              0 responses
              6 views
              0 likes
              Last Post Creamers  
              Started by Segwin, 05-07-2018, 02:15 PM
              12 responses
              1,786 views
              0 likes
              Last Post Leafcutter  
              Working...
              X