Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting indicator values backpainting asyncronously

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

    Setting indicator values backpainting asyncronously

    Hi,

    Just confused a lot now,
    I tried to set (example)
    Values[0][1] = 1.0; // CurrentBar is high and Values[0].Count is High

    via button press asyncronously just using some of those example indicators (added that line and needed plot and so on.)
    And there are plenty of values set and this is okay at OnBarUpdate no problem
    and as well if I set Values[0][0] from the button press, (but can't modify earlier ones via button press but okay during OnBarUpdate or any other like OnMarketUpdate)
    And even if I add my own custom series, same problem! (index is totally okay = 1)
    Just typical problem: Unhadled Exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

    Any idea?







    #2
    Hello raffu,

    A button event is not a NinjaScript event so the variables of your script wont make sense when used in that context. You very likely would need to wrap your code in a TriggerCustomEvent to execute it from that context. Plotting or doing other data related tasks from a button event is not a normal use case so extra logic is required to do that. The second example on the following page shows how to wrap some code in the trigger event.

    https://ninjatrader.com/support/help...ghtsub=trigger

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

    Comment


      #3
      Thanks Jesse, exactly that. I knew that it is some kind of context problem but couldn't figure it out .. It is working now. Thanks. (although of course I was planning to use it in Strategy Analyzers chart view but indicator is terminated (that was figured out earlier) and ..)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by FishTrade, Today, 12:00 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by chingus, Yesterday, 10:36 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by i2w8am9ii2, Yesterday, 06:29 PM
      2 responses
      8 views
      0 likes
      Last Post i2w8am9ii2  
      Started by Kirk Thorns, Yesterday, 05:34 PM
      0 responses
      9 views
      0 likes
      Last Post Kirk Thorns  
      Started by JobDjassem, Yesterday, 05:24 PM
      0 responses
      15 views
      0 likes
      Last Post JobDjassem  
      Working...
      X