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

Getting realized PNL on multi instrument

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

    Getting realized PNL on multi instrument

    If we use:

    Performance.RealtimeTrades.TradesPerformance.Curre ncy.CumProfit;

    To get the realized PNL of a strategy, is there something we can call to get individual realized for a particular instrument in a multi instrument strategy? I tried calling inside of each BarsInProgress, but it didn't seem to separate the pnl.

    Thanks

    #2
    Hello lookOutBelow,

    Thank you for your note.

    There is not a built in method/variable for retrieving the realized PnL by instrument in a single multi-instrument strategy.

    What you can do is track the PnL manually by instrument and then retrieve it when you need it. Depending on your needs, you would likely have something like an array of lists (because the number of instruments is likely fixed but the number of potentially simultaneously open orders is not), each list of which tracked the price at which each order filled per instrument. Then when the order exited, match the exit fill price to the entry fill price to determine your realized PnL per trade. You could use a double array to store the realized PnL per instrument and update each instrument's realized PnL each time a position exited.

    Please let me know if you have any questions or if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AaronKoRn, Today, 09:49 PM
    0 responses
    1 view
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    6 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    8 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,974 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X