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

Strategy Analysis Optimization - Trade selection

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

    Strategy Analysis Optimization - Trade selection

    Hi

    I wonder how can i get the trades listed under Display: Trades($) in Strategy Analyzer during Optimization?

    While in State.Terminated, if i run through the SystemPerformance.AllTrades collection, i'll get a bulk of trades but most of them are just duplicates. I would be interested into these trades which the Strategy Analyzer has preferably selected to show me in the Dispay tab.

    Thanks...

    #2
    Hello Sweet&Sour,
    Thanks for your post.

    I wonder how can i get the trades listed under Display: Trades($) in Strategy Analyzer during Optimization?
    There is no supported way of doing this. You would need to process that information in the strategy itself.
    While in State.Terminated
    Why have you chosen to use State.Terminated? The script is being destroyed at that point and alot of information would be unavailable anyway
    If i run through the SystemPerformance.AllTrades collection, i'll get a bulk of trades but most of them are just duplicates.
    There should be no duplicates in that collection. How are you confirming that there are duplicates? Can you run script at the following link? This script would not be able to run if there were duplicates present.
    Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Originally posted by NinjaTrader_JoshG View Post
      Why have you chosen to use State.Terminated? The script is being destroyed at that point and alot of information would be unavailable anyway
      Where's the best place within the code to enumerate all trades from the SystemPerformance.Trades collection?

      Here's the code snippet:
      if (SystemPerformance.AllTrades.Count > 1)
      {
      foreach (Trade myTrade in SystemPerformance.AllTrades)
      {
      using (StreamWriter outputFile = new StreamWriter(path, true))
      {
      string[] lines = System.Text.RegularExpressions.Regex.Split(myTrade .ToString(), " ");

      string fileOutput = string.Empty;
      foreach (var line in lines)
      {
      fileOutput = fileOutput + "|" + line.Split('=').Last().Replace("'", "");
      }
      fileOutput = fileOutput.Substring(1);
      outputFile.WriteLine(fileOutput);
      }
      }
      }

      Originally posted by NinjaTrader_JoshG View Post
      There should be no duplicates in that collection. How are you confirming that there are duplicates? Can you run script at the following link? This script would not be able to run if there were duplicates present.
      Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader
      Yes i'll do that over the weekend.

      Krgds
      S&S

      Comment


        #4
        Where's the best place within the code to enumerate all trades from the SystemPerformance.Trades collection?
        I wouldn't recommend OnStateChange() since we want to keep that as lean as possible. Why not to do it inside OnBarUpdate() ?
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        23 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        22 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X