Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddRenko() instrument name in Strategy Analyzer Optimization

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

    AddRenko() instrument name in Strategy Analyzer Optimization

    Hello, I have created a strategy that adds a renko data series to to the OnStateChange() method in the State.Configure block as shown below

    AddRenko(this.Instrument.FullName, 3, MarketDataType.Last);

    When running optimizer in the Strategy Analyzer the follow error occurs:

    "Error on calling 'OnStateChange' method: Object reference not set to an instance of an object."

    It appears that "this.Instrument.FullName" only works during the first iteration in optimizer but is null after. When hard coding the contract in place it works. Is this a bug or expected?

    #2
    Hello mvdn73,

    Thank you for your note.

    You should hardcode the instrument in your AddRenko call, as this.Instrument.FullName is not guaranteed to be known.

    At the following link, see the 3rd warning.



    I will add your vote to the feature request which covers dynamically adding data series.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    41 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    28 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    45 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    37 views
    0 likes
    Last Post CarlTrading  
    Working...
    X