• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 aaadetos, Yesterday, 08:39 PM
      0 responses
      5 views
      0 likes
      Last Post aaadetos  
      Started by Teebone21, Yesterday, 03:57 PM
      0 responses
      5 views
      0 likes
      Last Post Teebone21  
      Started by GeoOrtiz, Yesterday, 03:44 PM
      0 responses
      7 views
      0 likes
      Last Post GeoOrtiz  
      Started by ralett, Yesterday, 03:41 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Tyler  
      Started by Walker DM, Yesterday, 03:14 PM
      2 responses
      12 views
      0 likes
      Last Post Walker DM  
      Working...
      X