• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
    https://ninjatrader.com/support/foru...325#post490325
    JoshNinjaTrader 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.
      https://ninjatrader.com/support/foru...325#post490325
      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() ?
        JoshNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TazoTodua, Today, 12:21 AM
        0 responses
        7 views
        0 likes
        Last Post TazoTodua  
        Started by U0000999, Today, 12:20 AM
        0 responses
        7 views
        0 likes
        Last Post U0000999  
        Started by sidviciousX, Yesterday, 06:47 AM
        1 response
        21 views
        0 likes
        Last Post bltdavid  
        Started by Mykro, Yesterday, 10:22 PM
        0 responses
        7 views
        0 likes
        Last Post Mykro
        by Mykro
         
        Started by rudccv, Yesterday, 08:42 PM
        0 responses
        6 views
        0 likes
        Last Post rudccv
        by rudccv
         
        Working...
        X