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 maybeimnotrader, Yesterday, 05:46 PM
    2 responses
    21 views
    0 likes
    Last Post maybeimnotrader  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    32 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    7 responses
    32 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    22 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X