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

Reproducible but admittedly rare bug

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

    Reproducible but admittedly rare bug

    Hi guys,
    found a bug today. I can reproduce it, so I thought I'd let you know. Chances of users experiencing this are rare, though.
    I've been using a few StrategyPlot indicators, and syncing some of them to a secondary timeframe via this Add method:

    Add(StrategyPlot(Closes[1],0));

    The display works just fine.

    However, it breaks something inside Ninja, and now values obtained from Closes[1][] are incorrect. They report Closes[0][] instead.

    If I disable the adding of the StrategyPlot, everything goes back to working correctly. If I change the Add to this:

    Add(StrategyPlot(Medians[1],0));

    then the Closes[1][] work correctly again.
    I presume the Medians[1][] would now be screwy, but I didn't specifically check it. I'm guessing that that DataSeries used to sync the indicator gets broken somehow.

    Cheers,
    saltminer

    #2
    saltminer,

    You are not using StrategyPlot correctly. Please refer to the reference sample in how they Add the indicator and how to set values to that indicator.

    You should only be doing something like Add(StrategyPlot(0)) and none of that Closes[0][0] or any such DataSeries reference.

    To set the value to the StrategyPlot() is done inside OnBarUpdate() as demonstrated in the reference sample.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      If I report from BarsInProgress 0 a value that has been calculated in a higher BarsInProgress (I'm talking Historical here, where BarsInProgress occur in ascending order) the value will be a bar late.
      Hence I am delivering a value straight to a StrategyPlot inside BarsUpdate with BarsInProgress 1, in a timely manner.

      How would you suggest I use the Add() method to add a StrategyPlot synced to a higher BarsInProgress? I found I couldn't Set it from there if I Added it normally. (No error would occur, just that nothing displayed.)

      saltminer

      Comment


        #4
        saltminer,

        The method is shown in the reference sample. If you are worried about timing, place all your logic on the last BarsInProgress to trigger and back reference earlier ones.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by owen5819, Today, 02:24 PM
        0 responses
        1 view
        0 likes
        Last Post owen5819  
        Started by OllieFeraher, 05-09-2024, 11:14 AM
        4 responses
        14 views
        0 likes
        Last Post MisterTee  
        Started by dcriador, Today, 12:06 PM
        0 responses
        10 views
        0 likes
        Last Post dcriador  
        Started by dcriador, Today, 12:04 PM
        0 responses
        6 views
        0 likes
        Last Post dcriador  
        Started by cutzpr, Today, 08:54 AM
        0 responses
        11 views
        0 likes
        Last Post cutzpr
        by cutzpr
         
        Working...
        X