Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do i run a strategy in c# code

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

    How do i run a strategy in c# code

    Hi,

    I'd like to make a plot netProfit(x,y) by writing the result in a file.
    Is there a c# code like:
    s=strategy.run();
    result=s.netProfit();

    Thanks

    #2
    rGQRGs7,

    I am not sure what you mean exactly. Can you please clarify? If you meant writing to a file you can do so through this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3475
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Josh,

      For the time being i use the optimizer and set the keep # best results to all(for example: x=1:10:1 y=1:10:1 -> best results=100). and then export to .csv.
      Then i can plot netprofit(x,y) with whatever software.
      I know how to write to a file, i just need a:
      foreach(result_ res in results)
      writeline(res)

      Thanks

      Comment


        #4
        rGQRGs7,

        What you can try to do is at the end of each optimization run, write a line. You could hard code in when a specific time/date is reached to write that line and just have that time/date being that of the last bar on the chart.

        You will have to build what you want to write manually though. There is no code line you can access to generate a prebuilt report "line".
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_Josh,

          Thank you very much

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          95 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          49 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          31 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          35 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          72 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X