Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Strategy For Stop Loss

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

    NT8 Strategy For Stop Loss

    Hello,

    I'm trying to develop a strategy for my stop losses in NT8. Here are my requirements:
    1. My initial stop loss for the order is 40 ticks.
    2. If the price moves 80 ticks towards my profit target, the stop loss needs to move to breakeven.
    3. Once the stop loss has moved to breakeven, for every 40 ticks movement of the price towards my profit target, the stop loss moves 40 ticks. The stop loss moves only if the price moves a full 40 ticks towards my profit target, not on every tick.
    Can someone please help in how I can achieve this?

    Thanks.
    Last edited by bommakanti; 01-09-2023, 11:32 AM.

    #2
    Hello bommakanti,

    There is a sample of a break even strategy using the strategy builder in the following link. To do what you are asking would require using some logic to control a target using variables.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello bommakanti,

      There is a sample of a break even strategy using the strategy builder in the following link. To do what you are asking would require using some logic to control a target using variables.

      https://ninjatrader.com/support/foru...rategy-builder
      Hello Jesse,

      Thanks for the response and apologies for the delayed response from me. I was able to import the strategy into my NT8 but am not able to associate it with an order even though I have the strategy associated with my chart and enabled. Is this strategy just for automated entries or can I associate it with a manual order too?

      Comment


        #4
        Hello bommakanti

        NinjaScript strategies are all for automated entry, they cannot be attached to manual orders. The sample I linked submits its own entry and then controls the target based on logic. To work with manually placed orders requires using manual coding and the addon framework.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello bommakanti

          NinjaScript strategies are all for automated entry, they cannot be attached to manual orders. The sample I linked submits its own entry and then controls the target based on logic. To work with manually placed orders requires using manual coding and the addon framework.
          Hello Jesse,

          Thanks for the quick response. I'm quite familiar with coding so I should be OK with the manual coding part. Can you please point me to the addon framework and any other resources you may have to be able to help me with this.

          Comment


            #6
            Hello bommakanti,

            To use the addon framework for orders its best to use an indicator to exclude all normal strategy based logic and properties. You can see a sample of finding and subscribing to account events here:



            To observe manual orders you need to use the account events or collections to find the order you want, based on that event or object you could do other actions like submitting other orders or closing positions.


            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello bommakanti,

              To use the addon framework for orders its best to use an indicator to exclude all normal strategy based logic and properties. You can see a sample of finding and subscribing to account events here:



              To observe manual orders you need to use the account events or collections to find the order you want, based on that event or object you could do other actions like submitting other orders or closing positions.


              https://ninjatrader.com/support/help...nt8/submit.htm
              Hello Jesse,

              Let me further clarify what I'm trying to do:

              1. I put in a manual order (limit or market, doesn't matter) with an initial stop loss. So let's say I buy one ES contract at 4100. My initial stop loss is at 4080.
              2. If ES rises to 4120, I want the stop loss to be moved to break-even i.e. 4100.
              3. For every 10 more points of ES price increase, I want the stop loss to move by 10 points. So if ES goes to 4130, I want the stop loss to move to 4110. If ES then goes to 4140, the stop loss should move to 4120. If ES then goes down to 4130, nothing happens. Depending upon the price action, either my stop loss is triggered or it keeps moving up by 10 points every time ES moves by 10 points.

              Can you please let me know what is the best way of achieving this.

              Comment


                #8
                Hello bommakanti,

                To do that you still need to use the addon framework.

                1) manual order submitted will trigger the OrderUpdate/ExecutionUpdate events on the account. You need to subscribe to the account like the linked sample in the previous post to see that event.
                1.5) store the order to a variable from ExecutionUpdate so you can retrieve the average fill price.
                2) use the indicators OnBarUpdate to make price conditions. If the condition is true use the account.Change method to update the order.
                https://ninjatrader.com/support/help...nt8/change.htm
                3) you can see a sample of doing the math to move a trail based on an interval in the following link, you can do the same thing in your indicator. You need to use OnBarUpdate and trail by the offset amount calling Change each time you need a change.
                https://ninjatrader.com/support/foru...596#post806596
                Last edited by NinjaTrader_Jesse; 02-17-2023, 03:36 PM.

                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello bommakanti,

                  To do that you still need to use the addon framework.

                  1) manual order submitted will trigger the OrderUpdate/ExecutionUpdate events on the account. You need to subscribe to the account like the linked sample in the previous post to see that event.
                  1.5) store the order to a variable from OrderUpdate or ExecutionUpdate so you can retrieve the average fill price.
                  2) use the indicators OnBarUpdate to make price conditions. If the condition is true use the account.Change method to update the order.

                  3) you can see a sample of doing the math to move a trail based on an interval in the following link, you can do the same thing in your indicator. You need to use OnBarUpdate and trail by the offset amount calling Change each time you need a change.

                  Ok thank you. I will try this out and let you know if I face any issues.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  126 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X