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

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 nicthe, Today, 09:24 AM
    1 response
    5 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by samish18, Today, 10:13 AM
    0 responses
    3 views
    0 likes
    Last Post samish18  
    Started by kenz987, Yesterday, 10:20 AM
    2 responses
    13 views
    0 likes
    Last Post kenz987
    by kenz987
     
    Started by nicthe, 08-23-2023, 07:53 AM
    7 responses
    196 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by stalt, 12-28-2015, 01:36 PM
    6 responses
    1,536 views
    0 likes
    Last Post giulyko00  
    Working...
    X