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

Multi-strategy exit when target P/L is reached

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

    Multi-strategy exit when target P/L is reached

    I run the same strategy on several different instruments concurrently.

    Obviously each strategy has its own P/L. So is it possible and if so how would I be able to exit all positions in all strategies when a cumulative target P/L of all strategies is reached?

    Thanks

    #2
    Hello John833,

    Thank you for your note.

    This is not possible because a strategy is only aware of the instance of itself and not any other instance of any strategy. Also, there is no way to invoke Flatten Everything from within a NinjaScript.

    However, I understand that this would be a useful feature and I will submit this inquiry as a feature request to our development department. Thank you for your feedback and suggestions. We value your opinions and they will be considered in our feature discussion for a future NinjaTrader release.

    I will update you with a tracking ID for this feature request when I receive an update from our development department.

    For the time being you would need to keep an eye on your account PnL and when the desired amount is reached, click File -> Flatten Everything.
    Last edited by NinjaTrader_ChelseaB; 05-10-2013, 10:43 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea B

      Yes I am aware of File -> Flatten Everything, but I have other positions open which are not generated by the strategies. So how can I avoid these open positions from being flattened?

      Comment


        #4
        Hi John833,

        You would need to disable each strategy manually to prevent positions that are not from strategies from closing as well.

        Let me know if I can be of any other assistance.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by John833 View Post
          I run the same strategy on several different instruments concurrently.

          Obviously each strategy has its own P/L. So is it possible and if so how would I be able to exit all positions in all strategies when a cumulative target P/L of all strategies is reached?

          Thanks
          Try to save the profit of each strategy on a text file. Once the strategy closes a position then query first the last profit being saved in the text file and add it to the current profit of the position being closed. In that case you always saved the cumulative profit of all the strategy running. Don't forget to always query the last saved profit and add it to the current profit.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by StockTrader88, 03-06-2021, 08:58 AM
          45 responses
          3,991 views
          3 likes
          Last Post johntraderuser2  
          Started by TAJTrades, Today, 09:46 AM
          0 responses
          7 views
          0 likes
          Last Post TAJTrades  
          Started by rhyminkevin, Yesterday, 04:58 PM
          5 responses
          62 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by realblubb, Today, 09:28 AM
          0 responses
          8 views
          0 likes
          Last Post realblubb  
          Started by AaronKoRn, Yesterday, 09:49 PM
          1 response
          19 views
          0 likes
          Last Post Rikazkhan007  
          Working...
          X