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 DannyP96, 05-18-2026, 02:38 PM
          1 response
          27 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          117 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          69 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          226 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          417 views
          0 likes
          Last Post CaptainJack  
          Working...
          X