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

How to determine result of trades?

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

    How to determine result of trades?


    Hi there, how do I determine the failure/success of multiple trades from different strategies?

    Say I have three different strategies, each with 6 point tick profit/stop loss. I'm running all three strategies in the same chart on the same instrument and time frame. Each of these three strategies fires off twice during the trading day. Now, at the end of the trading day, I want to see the results from each individual trade from all three of these different strategies. That is, since I have three strategies, each which fired off twice, I want to see the individual results from all six trades.

    I'm aware of how I can use SystemPerformance.AllTrades, but that captures the cumulative performance. Instead, I need the performance of each individual trade from each strategy, after each trade is completed by the end of day.

    Thanks for your help again,







    Last edited by timmbbo; 01-31-2023, 02:53 PM.

    #2
    Hello timmbbo,

    Thanks for your post.

    The Strategy Performance window could be used to view the performance of a strategy. You could use the Trades Display of a Strategy Performance report to compare the results of individual trades.

    See this help guide page for more information about how to use the Strategy Performance feature: https://ninjatrader.com/support/help...egyPerformance

    Please let me know if I may further assist you.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3

      Brandon, thanks. Unfortunately, this isn't the right solution for me, due to error, "The OCO ID cannot be reused"

      In reality, I'm testing hundreds of different strategies at once. I have each strategy as its own individual strategy file. I then load up hundreds of these strategies into a chart, each with different variables. So, I can do the exact same order four times, each with different profit/loss targets. During the trading session, I sometimes get error "The OCO ID cannot be reused". Then, on that trade, the stop loss and profit targets are not honored, leading to unpredictable behavior. I think what's going on is, I have trades firing off simultaneously to NT, and NT is getting the handles confused between these simultaneous orders.

      To fix this, I'm going to put all of my different strategies into one master strategy file. This way, all orders will then be submitted sequently. The bummer of this method though, is, I need now to keep track of the performance of each induvial trade.

      So, working through my example, I have one strategy, which four variations of profit/loss stops. If I run this as four different strategies, I can get the "The OCO ID cannot be reused" error. So, it's now my goal to combine into one single strategy, and then fire off four orders with the different profit/loss set, and then keep track of the success of each of those orders.

      Your thoughts? Thanks again.





      Comment


        #4
        Hello timmbbo,

        Thanks for your note.

        The error "The OCO ID cannot be reused" indicates that your strategy has submitted an order that is reusing an OCO ID. You would need to ensure that the strategy instance is submitting new OCO-tied orders using unique OCO IDs.

        You could consider adding something to each submitted instance of the protective orders that are unique like CurrentBar.

        An example script shared by my colleague Chelsea demonstrating using OCO-tied orders could be seen on this forum thread: https://ninjatrader.com/support/foru...579#post770579

        To access information about trades made by a strategy you may use the SystemPerformance.AllTrades collection. Note that a trade consists of an Entry and Exit.​

        You could consider looping through the trades in the SystemPerformance.AllTrades TradeCollection to get TradesPerformance information about each trade made. See example number 2 on the TradeCollection help guide page for an example of looping through a TradeCollection.

        GetTrades() could be used to get information about a specific instance of a trade defined by its entrySignalName.

        SystemPerformance.AllTrades: https://ninjatrader.com/support/help.../alltrades.htm
        TradeCollection: https://ninjatrader.com/support/help...collection.htm
        TradesPerformance: https://ninjatrader.com/support/help...erformance.htm
        GetTrades: https://ninjatrader.com/support/help.../gettrades.htm

        Let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frandepaulapr, Today, 04:14 AM
        0 responses
        9 views
        0 likes
        Last Post frandepaulapr  
        Started by ThePicsou, 07-22-2024, 11:36 AM
        4 responses
        30 views
        0 likes
        Last Post ThePicsou  
        Started by marco231, 03-20-2024, 03:56 PM
        7 responses
        176 views
        0 likes
        Last Post marco231  
        Started by Irukandji, 04-22-2024, 04:33 AM
        7 responses
        37 views
        0 likes
        Last Post Irukandji  
        Started by Irukandji, Today, 01:56 AM
        0 responses
        7 views
        0 likes
        Last Post Irukandji  
        Working...
        X