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 jukilo2000, Today, 02:55 AM
                2 responses
                23 views
                0 likes
                Last Post jukilo2000  
                Started by dan66, Today, 09:21 AM
                0 responses
                2 views
                0 likes
                Last Post dan66
                by dan66
                 
                Started by xiinteractive, Today, 07:31 AM
                3 responses
                10 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by dj22522, Today, 07:21 AM
                2 responses
                25 views
                0 likes
                Last Post dj22522
                by dj22522
                 
                Started by dj22522, 01-09-2023, 04:03 AM
                3 responses
                56 views
                0 likes
                Last Post NinjaTrader_Spencer  
                Working...
                X