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

With Strategy Builder, how can we exit and stop the strategy after...

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

    With Strategy Builder, how can we exit and stop the strategy after...

    Hi all,

    With Strategy Builder, how can we exit all trades and cancel all orders and stop the strategy after x $ loss or y $ profit on the day?

    Thanks!

    Greg

    #2
    Hello Greg,

    Thank you for your post.

    We have a DailyLossLimitBuilderExample_NT8 that has been posted here:
    https://ninjatrader.com/support/foru...ples#post93881

    The Strategy Builder does not have any actions available to stop the strategy altogether, though the examples uses a custom series with offsets to be able to perform math and it subtracts the total PnL from yesterday's PnL to get the curren't day's PnL so that it may be reset for each day. If you would like to be able to disable the strategy programmatically, this would need to be done with CloseStrategy() in an unlocked script:
    https://ninjatrader.com/support/help...sestrategy.htm

    We have an example of how to halt a strategy once a Profit/Loss is hit in an unlocked strategy here:
    https://ninjatrader.com/support/help...nce_user_d.htm

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Emily I suppose we could, in a live account, set the rules in our NT brokerage too right (i.e. exit and not allow trading if a profit target and daily loss hit)? Then, the strategy would not be able to trade because it would be set at the brokerage level?

      Can we create a broker-side sim account that can follow broker-side risk parameters vis just using Sim 101 account in the NT platform as well?

      Thanks.

      Comment


        #4
        Hello Greg,

        Thank you for your reply.

        Yes, you may set a daily loss limit or profit trigger on your NinjaTrader brokerage account:
        https://support.ninjatrader.com/s/ar...language=en_US
        https://support.ninjatrader.com/s/ar...language=en_US

        That being said, the strategy does incorporate logic that will only submit trades when the profit/loss is within a set range. Although the strategy would not be disabled, it would not submit new entries once the profit/loss is outside of the defined values due to the logic in place.

        You may not create a broker-side sim account; you would only be able to set risk via the settings in the NinjaTrader platform:
        https://ninjatrader.com/support/help...ding_risks.htm

        I hope this helps to clarify. Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Nice. Ok. I will work with different approaches here. Also, how can we pull the value of the highest watermark the p n l realized has achieved during the day?

          Comment


            #6
            Hello Greg,

            Thank you for your reply.

            Please clarify what you are referring to; do you mean the highest PnL that has been reached during the session (whether it is the current PnL or if it has gone down since that high was met) or something else? Are you looking to track this in the Strategy Builder or via an unlocked script in the NinjaScript Editor?

            I look forward to your response.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              NinjaTrader_Emily Yes. Exactly. Looking for being able to evaluate for the highest realized profit during the day and would like to keep it in the Strategy Builder.

              Comment


                #8
                Hello Greg,

                Thank you for the clarification.

                I have created a video demonstrating how to keep track of the highest realized profit of the day in a variable within the Strategy Builder:
                https://www.screencast.com/t/WIL1pMpa4chz

                Please let me know if I may be of further assistance.
                Emily C.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Douglee, Today, 01:34 PM
                0 responses
                1 view
                0 likes
                Last Post Douglee
                by Douglee
                 
                Started by pjsmith, 10-28-2021, 03:01 AM
                8 responses
                80 views
                0 likes
                Last Post WalterSkinner  
                Started by sjmuk1, Today, 10:18 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Started by alanack, Today, 09:33 AM
                4 responses
                32 views
                0 likes
                Last Post alanack
                by alanack
                 
                Started by Skechers, Today, 11:37 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Working...
                X