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

Swing Indicator crashes on right conditions with Range bars

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

    Swing Indicator crashes on right conditions with Range bars

    Let's say I want to attach the Swing indicator to an EMA through a strategy and put the Swing superimposed over the EMA in the same panel. I was able to do just that and it works like a champ. But I want to do this in a strategy where I need Tick Replay to be true and Calculate = OnPriceChange.

    If I use those parameters I get the following errors:
    2/13/2018 17:19 Default Failed to call 'Add' method: System.NullReferenceException: Object reference not set to an instance of an object. at NinjaTrader.NinjaScript.NinjaScriptBase.ResetLastB ars(BarsUpdateEventArgs e) at NinjaTrader.NinjaScript.NinjaScriptBase.ResetLastB ars(BarsUpdateEventArgs e) at NinjaTrader.NinjaScript.NinjaScriptBase.ResetLastB ars(BarsUpdateEventArgs e) at NinjaTrader.NinjaScript.NinjaScriptBase.<>c__Displ ayClass181_2.<TickReplayOrUpdate>b__2(Object s, BarsUpdateEventArgs o) at NinjaTrader.Data.BarsSeries.Add(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Double tickSize, Boolean isBar, Double bid, Double ask)
    2/13/2018 17:19 Default Indicator 'Swing': Error on calling 'OnBarUpdate' method on bar 1: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
    Well, that's ugly - try the screenshot of the error. (attached)

    Also, I attached the strategy that demonstrates the errors...

    1. Load a chart of any instrument you like -
    2. I used the YM on 12 tick Range Bars.
    2. Tick the Tick Replay check box.
    3. Now load the strategy and set Calculate = OnPriceChange.
    4. Start the strategy.

    Note: if you set Calculate = OnBarClose, it works. Tick Replay in conjunction with OnPriceChange or OnEachTick is how you need to go to reproduce the error, which of course is how I need to work in my strategy.

    Note: It apparently works fine on any other bars with Tick Replay checked and Calculate = OnPriceChange or OnEachTick. You need to use Range bars to get it to fail.

    If the fix is in the bars and not the indicator, can you tell me what you did to fix it so I can also fix it in the bars I'm using? I'm using a variation of a Range bar and that's where the errors first appeared.
    Attached Files

    #2
    Hello,

    Thank you for providing the sample.

    I am currently reviewing this item and will reply back here once I have further details on this request.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Did you get a chance to verify this? I'm thinking it might take you all of 5 minutes to verify this since you just have to load it on a chart and see... Not sure how long it will take to find a solution but it would be good to know if someone is looking at it.

      Thanks.

      Comment


        #4
        Hello,

        Thank you for the reply.

        Yes, I was able to see the error but at this point have no further details I can relay. Once I have more details on this request I will reply back here.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kaledus, Today, 01:29 PM
        5 responses
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PhillT, Today, 02:16 PM
        2 responses
        7 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Working...
        X