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 NullPointStrategies, Today, 05:17 AM
          0 responses
          23 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          120 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X