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

keep and analyse historical trades inside a strategy logic

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

    keep and analyse historical trades inside a strategy logic

    as I am not very experienced in programing, wanted to consult about which path to choose.

    Asume I have a strategy that runs and does its thing intraday.At the end of day all positions are closed.
    when it runs is has successful trades that reach target and also trades that end up with a stoploss
    it also looks for some price patterns and acts upon them.
    so I have various counters that count the patterns and how the strategy behaved

    I would like to add some logic that will be based on previous days' trades. For example a week worth of trades.
    So I assume I need to include some mechanism that will keep the historical results in some sort of list/dictionary etc. so it can be accessed in real time and analysed for trade decisions.

    I am looking for advice about how to approach this.

    I dont think I need to export the data into some external text file or excel . But maybe this can be a better idea ? and I can keep the files outside the strategy to look for some statistics of my own afterwards.

    So what are the basic options / directions I can go to? What do other people use in such a case?

    Thanks

    #2
    Hello dadarara,

    Thank you for the post.

    In NinjaTrader 8 you may use the Account class to retrieve account information. The Account object includes a collection of Orders and Executions on the account the strategy is running on.

    Each order in the Orders collection contains a "FromEntrySignal" property. If your strategy applies entry signals to each of the orders that it makes, you can use the FromEntrySignal property to identify only the trades that the strategy made.

    Below is a link to the help guide on the Account class.



    Creating your own CSV file is an option as well. Below is a public like to Microsoft's SteamWriter example. You can do the same thing in NinjaScript:


    Please let me know if I can assist further.
    Chris L.NinjaTrader Customer Service

    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
    10 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