Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Questions about exporting data to Excel

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

    Questions about exporting data to Excel

    Hi,

    I'm trying to make a strategy analyzer that is more suitable for the current strategy I'm running. However I have a couple of problems that I was hoping someone could help me with.

    Basically I'm exporting data from NT to Excel and I am having a very hard time trying to find the right way of finding certain values:

    - Cumulative profit by period, like the values you see under the "Periods" tab in Strategy Analyzer.

    - Entry price of first trade

    - Exit price of last trade

    Also I have a question regarding how NT runs a backtest when I test multiple instruments. Does it run through one instrument at a time, or does it run through all of them at the same time bar by bar? I'm guessing its the first one, but I just have to be sure.

    Is there any way to differentiate between the different instruments while it is backtesting? I'm asking because if I don't manage to differentiate between the instruments I will just see the last instrument NT tested in Excel.

    Hope I made the questions understandable.

    - Stoop

    #2
    Hello Stoop,
    You can use the TradeCollection class to find the trades. To get the first and last trade please use the below code snippet.

    Code:
    Trade t = this.Performance.AllTrades[0];
    Trade t1 this.Performance.AllTrades[this.Performance.AllTrades.Count - 1]


    Yes, NinjaTrader runs one instrument at a time if you are backtesting a list of instruments.

    You can use the Instrument class to do it. Please refer to our help guide to know more
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you very much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DavidHP, Today, 07:56 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by kujista, Today, 06:23 AM
      3 responses
      9 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by Mindset, Yesterday, 02:04 AM
      2 responses
      18 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Working...
      X