Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Program to Stop Trading for the Day.

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

    Program to Stop Trading for the Day.

    Hi

    How do I program Ninja to stop trading for the day after a certain PnL is reached ?
    It could be profit or loss.

    Let's say I want Ninja to stop trading for the day after reaching $500 profit.

    Also, if I hit 400$ loss (or certain % of my daily loss limit) I want ninja to stop trading for the day.

    Please inform how to do this.

    #2
    Hello Karthink007,

    Thank you for your note.

    You would want to use TradePerformance for the strategy to calculate how well the strategy is doing in terms of Loss or Profit.

    Below are two reference samples that you can use for this setup.
    The first is on how to use the performance for money management -
    http://www.ninjatrader.com/support/f...ead.php?t=4084

    The second is resetting your values at each new session -
    http://www.ninjatrader.com/support/f...ad.php?t=19182

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Cal! worked well!

      Comment


        #4
        Hi Cal. The code seems to be working, but is there any other simple way to achieve the same result ?

        Say..

        I want to stop trading after reaching 400$ loss incurred due to either 1 or multiple trades on a particular day. &

        Stop trades after reaching $500 daily profit goal.

        The logic in your example is confusing to me. Please tell if there is any other way to achieve the same result. I came across Disable() in the help guide, but not able to implement it with success.

        Comment


          #5
          Hello karthik007,

          Thank you for your response.

          You would still need to use the Performance values used in the example from Cal. If you just wish to disable the strategy and you will manually enable the strategy on the next session your could use Disable().

          For example:
          if(Performance.RealtimeTrades.TradesPerformance.Cu rrency.CumProfit <= myValue)
          Disable();

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          599 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          344 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          558 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          557 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X