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

Import Existing Portfolio

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

    Import Existing Portfolio

    I have a portfolio of 91 stock trades each with an entry date, exit date, entry price, exit price. This detailed data is in a ".csv" file. I want to import this data and then go back to the entry date and find the lowest low during the life of the trade and its date. I'd also like to know the lowest price was on the day that the position/trade was entered. (These are all multi-day held positions).

    My initial thought was to import this data, then 'simulate' the trade by creating a strategy that enters the trade on the specified date and exist on the specified date, etc. But am I correct in saying that this would require adding every symbol as a data series in the strategy? I suppose this is doable brut force, but before I go down this route, I wanted to check with you.

    Since each stock/trade will have its own specific entry/exit dates & price, I'm really just trying to use the tracking mechanism in strategy performance to find the MAE/MFE during the life of each trade.

    However, since I want a specific (and different) entry date/price for each symbol, it seems I am still going to have to embed these symbol/dates/prices into the strategy by importing them.

    My thought is something like this: (I'm giving an example using shorthand notation, not actual code)

    Find the entry/exit date and price from the imported data for each symbol, then enter a trade on the specified date at the given price, then set a profit target or stop at the specified target and on the specified date.

    I should have an entry/exit for each symbol/date combo.

    Is this the most straightforward way to do this?

    #2
    Hello EminiTrader,

    Your description would be the correct approach and you are correct about having to add the secondary series if you wanted to do a basket type test. In general there is not a supported way to add series dynamically so setting up a test strategy that just adds the instruments you have in that csv would be what is necessary. The alternative is to use a single series strategy and have it pull the correct data for that instrument out of the csv.

    In either case you could then run the strategy in any tool which can go over that timespan of data to pull trades from your CSV and submit them. The only caveat here is that if a trade is submitted but does not occur you might end up with some discrepancies. If the trade data was trades from your current provider/data set then the data should match whats in your csv and should in theory be able to submit at those points in time again. If you are using a different data set and some data was missing or different you might not end up with the exact same placement/timing.

    I look forward to being of further assistance.



    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by traderqz, Yesterday, 04:32 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by f.saeidi, Today, 05:56 AM
    1 response
    3 views
    0 likes
    Last Post Jltarrau  
    Started by Jltarrau, Today, 05:57 AM
    0 responses
    4 views
    0 likes
    Last Post Jltarrau  
    Started by Stanfillirenfro, Yesterday, 09:19 AM
    7 responses
    51 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by TraderCro, 04-12-2024, 11:36 AM
    4 responses
    70 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X