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

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 Graci117, Today, 11:40 PM
          0 responses
          3 views
          0 likes
          Last Post Graci117  
          Started by BIOK.NT, Today, 01:56 PM
          2 responses
          11 views
          0 likes
          Last Post BIOK.NT
          by BIOK.NT
           
          Started by i2ogu3, Today, 11:31 PM
          0 responses
          4 views
          0 likes
          Last Post i2ogu3
          by i2ogu3
           
          Started by RDTrader16, Today, 10:19 PM
          0 responses
          8 views
          0 likes
          Last Post RDTrader16  
          Started by gemify, 03-08-2023, 08:02 AM
          9 responses
          150 views
          0 likes
          Last Post culpepper  
          Working...
          X