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

simulation index variabile inside a strategy when running optimization

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

    simulation index variabile inside a strategy when running optimization

    Hi, strategy and optimization tech question.
    I'm adding a perturbation analysis to my strategy development that save a different equity curve each simulation run.
    I would have a dynamic variable inside the strategy identifying the backtest index.

    To make an example:
    Strategy name: "MySTrategy"
    Optimization parameter: take profit, from 60 to 100, step 10

    When launching the strategy analyzer, five backtests will be executed.
    I'm looking for a variable available IterationIndex inside the strategy, say from 1 to 5, so to be able to save results like:
    SaveFileName = "MyStrategy" + IterationIndex.ToString()

    At the moment I'm using a combination of all optimization parameters converted into a string. That's a working solution but not a general one neither elegant.
    SaveFileName = "MyStrategy" + TakeProfit.ToString() + StopLoss.ToString() + ....... + ".csv"

    I also tried to generate a brute random variable but it seems that this approach cannot work being the seed linked to at internal clock at ms value, too slow indeed.

    Btw, here the typical result of this kind of analysis when plotted with my python script.

    Thanks
    Attached Files
    Last edited by simone.bern; 05-26-2022, 01:18 AM.

    #2
    Hello simone.bern,

    Thank you for your post.

    We would suggest trying System.Guid.NewGuid().ToString() or this.GetHashCode() in State.DataLoaded to get a unique identifier.

    However, you may find that what you're doing to track all settings in a string may be more informative.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you Kate, that perfectly.suits my needs.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by AaronKoRn, Today, 09:49 PM
      0 responses
      7 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Today, 08:42 PM
      0 responses
      9 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Today, 07:51 PM
      0 responses
      10 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,980 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      9 views
      0 likes
      Last Post rbeckmann05  
      Working...
      X