Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

close Nijnja after daily 5 points

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

    close Nijnja after daily 5 points

    Hello:
    Is there an automated way using an indicator or strategy to exit Ninja trader once I have reached some daily profit value let's say 5 points ? My issue is I am over trading and giving up all after profitable. This is just to set some discipline. Thank you.

    #2
    Hello mtamaku,

    Thanks for writing in.

    This would be possible in the context of C# but we do not offer a supported means to shut down the platform through NinjaScript. One option would be to apply logic to your strategies so they stop taking trades after a certain point, however.

    The Performance object could be used to get a strategies trade performance, or you can use GetAccountValue() to monitor the RealizedProfitLoss of the account. GetAccountValue(AccountItem.RealizedProfitLoss) will not be shown in points since it is a collective figure involving multiple instruments.

    NinjaTrader 8 has a CloseStrategy() method which can cancel orders and close positions made by the strategy, but NinjaTrader 7 would need to have that functionality implemented by the strategy developer.

    I've included documentation links to the items discussed as well as a sample for creating a time filter.

    Performance - https://ninjatrader.com/support/help...erformance.htm

    TradesPerformance - https://ninjatrader.com/support/help...erformance.htm

    GetAccountValue() - https://ninjatrader.com/support/help...countvalue.htm

    SampleTimeFilter - https://ninjatrader.com/support/foru...ead.php?t=3226

    Please let me know if you have any additional questions.

    Comment


      #3
      Print(GetAccountValue(AccountItem.RealizedProfitLo ss + " " + "Realized PnL"));

      gives "The name "GetAccountValue" does not exist in the current context error. Any variables or oninitialize statements needed here? Regards

      Comment


        #4
        Hello elliot5,

        You will need to check your syntax. In your snippet, you are calling GetAccountValue with AccountItem.RealizedProfitLoss + " " + "Realized PnL" instead of AccountItem.RealizedProfitLoss.

        See here for a test with proper syntax - https://i.imgur.com/Scm8Yd5.png

        We look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        51 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        142 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        275 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X