Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Export strategy analyzer trades

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

    Export strategy analyzer trades

    Hi Ninjatrader,
    I wrote a complete portfolio back testing software that fits all my needs.
    The only problem I have is how I export trades of a multi instrument Backtest.
    Right now the only way I found to do it as easy as possible was writing a 'Print' command on both OnExecutionUpdate and OnOrderUpdate, to print all the trades details I need (entry&exit date and price, instrument, trade side, etc.. ) from Performance matrics,
    This way I can catch all the trades in a single copy from the output window.

    There is a few problems with this method,
    1. This can only be done on a coded strategy, and not on a builder strategy, which makes idea creation a bit of a hussle.

    2.it is not automatic, which I would much prefer.
    __________


    The optimal setting for me is to add functionality to the 'Run' button or add a new button beside it, which will start capturing all the trades to a file, and end capturing at the end of the test.

    Is there any way to accomplish this outside the strategy code? Anywhere else I can capture orders from market analyzer?

    BTW excel export are not good enough as it can't export multi instrument trades in one click.

    Thanks in advance
    Noam
    ​​

    #2
    Hello bugo11,

    There would not be a way to automate this outside code.

    The only other choice would be to do this manually. In the Strategy Analyzer select the Trades display. Right-click the grid -> select Export.

    Below is a link to the help guide.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thanks for the fast reply.
      Just to make sure, the only way to to this by code is from strategy only?
      Is there a way to use onOrderUpdate and onExecutionUpdate of the account maybe?, I tried but with no luck, just want to check if its possible.


      Edit:BTW I have no problem creating an add on if there is a way to access performance metrics of a Backtest from code, pls let me know if possible
      Thanks in advance
      Noam
      Last edited by bugo11; 08-07-2022, 11:10 PM.

      Comment


        #4
        Hello bugo11,

        It would be much easier to write trade information from OnPositionUpdate() when the SystemPerformance collection updates than from another script type.

        As a heads up, OnExecutionUpdate() updates for executions (fills), and OnOrderUpdate() updates for order updates. OnPositionUpdate() will update when the trades in the SystemPerformance collection updates.

        A PerformanceMetric script does have OnAddTrade() which provides each a trade object as it updates.

        From an addon approach, order and execution updates only happen for real-time orders. Backtest orders do not affect an account.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea, Thank you for replying,
          It seems that OnAddTrade() of PerformanceMetric did the trick regarding collecting all the trades, so thank you for pointing that out!

          Is there a way to add functionality to the 'Run' button in the strategy analyzer?
          My main goal is to make the data transfer the easiest as possible,
          So if I could, for example, create a static list that will store all the trades of the current test, (which would be cleared each time the 'Run' button is pressed), and at the end of the test will create a file with all the trades.

          Another slightly less convenient way would be to add a button next to the 'Run' button which will do the mentioned above.

          Is any of it possible?

          Hope you can help
          Thanks in advance!

          Comment


            #6
            Hello bugo11,

            "Is there a way to add functionality to the 'Run' button in the strategy analyzer?"

            No, it would not be supported, and I am not aware of any unsupported route.

            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cre8able, 02-11-2023, 05:43 PM
            3 responses
            236 views
            0 likes
            Last Post rhubear
            by rhubear
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            113 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            46 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by rocketman7, Today, 09:41 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by traderqz, Today, 09:44 AM
            2 responses
            10 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X