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

Custom Strategy Performance Metrics

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

    Custom Strategy Performance Metrics

    Hi guys,

    Perhaps this should be in a new thread but it kind of relates.... I have been attempting to get data upon entry orders from a strategy and analyze these at a later date. I could always collect these variables at the time of initially entering the code, but I would prefer these would be actual filled trades. Even if I did collect the information at the time a trade was entered, because I want to track when we exited the trade and if it was profitable, I would need to associate it to an Order ID later I suppose?

    For example, lets say I want to track the EMA or Momentum (or any indicator) that was currently in place when the trade was executed...

    The ideal solution would be if we were able to add performance metrics columns in the datagrid that gets exported. I have seen the examples for sample performance metrics you guys have provided, but as far as I know there is no way to link that type of field as a column in the datagrid within strategy analyzer or trade performance? If there is, please let me know.

    So for example... Lets say we want to track trades and I want the momentum(14) at the time of entry and the time of exit of a trade? What would be the best way about doing that? If we can't add columns to the grid, would I need to track this and monitor OnExecutionUpdate?

    If I later loop through the trades... How would I get the momentum at that time? Is there an example with BarsRequest in combination with performance of trades where I can later go back to the entry time and exit time of the bar and use it with an indicator such as momentum?

    Thanks in advance!

    -Chad
    chadnash
    NinjaTrader Ecosystem Vendor - Nash Technologies

    #2
    Hello, thanks for writing in. I moved your post to a new thread as the other was older.
    Hello, I need to acces an array (or list) of Orders created to iterate all orders submitted and make some action. It doesn't matter if they were full or not. Could you give me some sample code? I picture something like that: for( int i = 0 ; i < orders.Count ; i ++) if(orders[i].Name== "order1234")


    There is no way to add extra columns to the result export, so you would need to keep your own record of this data in OnExecutionUpdate to record the indicator values when an execution occurs. You can write to a CSV file or use this example to interface with Microsoft Excel:


    Kind regards,

    -ChrisL


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      ok so I have no problems saving data as data stream or writing to CSV ETC…

      But then in that case I still don’t know the process for properly actually accessing the data from that time period.

      would it be best to use OnExecution update? But in that case I would not be able to reference BARS right? As bars executes seperate from that event.

      the trade collection doesn’t have bar numbers exactly… so I can loop through trades but I need to be able to reference the data.

      Any examples of being able to collect this data properly… then I can focus on saving it to CSV.

      so a simple example would be… “how to get 14 period EMA from the time of entry from a completed trade”

      Chad
      chadnash
      NinjaTrader Ecosystem Vendor - Nash Technologies

      Comment


        #4
        Hello, thanks for the follow up. OnExecutionUpdate is not a data-driven event method, so TriggerCustomEvent() should be used to sync the price and indicator series in your script prior to accessing them in the event. There are a couple of examples on the documentation page here:



        If you have questions specific to your script after trying it out please let me know.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,984 views
        0 likes
        Last Post rene69851  
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        2 views
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        7 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,791 views
        0 likes
        Last Post aligator  
        Working...
        X