Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using mulitples stops and profits for 2 different orders

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

    Using mulitples stops and profits for 2 different orders

    Hi,

    I have two different orders: Short Trade and Test Trade. I'm using the next code:
    Code:
    if(...) {
    SetProfitTarget("Short Trade", CalculationMode.Currency, profit_price1);
    SetStopLoss("Short Trade" ,CalculationMode.Currency, stop_price1, false);​
    EnterShort(1, "Short Trade")
    }
    ....
    if(...) {
    SetProfitTarget("Test Short", CalculationMode.Currency, profit_price2);
    SetStopLoss("Test Short" ,CalculationMode.Currency, stop_price2, false);​
    EnterShort(1, "Test Short")
    
    }
    The first order to be filled is Short trade and it takes the profit and stops correctly. The problem is when the "Test Short" order is filled:

    ​​​​​​​Click image for larger version

Name:	image.png
Views:	155
Size:	68.2 KB
ID:	1217483

    Why do stop and profit linked to Short trade have the contracts duplicated and also the new Stop and Profit for "Test Short" are duplicated?​

    #2
    Hello lju45,

    Thank you for your post.

    I suspect this may be related to the StopTargetHandling setting for the strategy. When you are running the strategy, what option do you have selected for "Stop & target submission" under the Order handling section of the properties? Here is a screenshot showing which property I am referring to:
    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    The options are 'Per entry execution' or 'By strategy position' and if you have your stop loss and profit target orders placed based on the strategy position, the order quantities will match the strategy position and not just the quantity for the tied entry order. If you are wanting to have the order quantity based on each separate entry in your strategy, you will need to elect Per entry execution. For more information:


    Please let me know if I may be of further assistance.

    Comment


      #3
      Thanks,
      I'm using "Per entry execution"
      Click image for larger version  Name:	image.png Views:	0 Size:	153.9 KB ID:	1217808
      Click image for larger version  Name:	image.png Views:	0 Size:	95.3 KB ID:	1217805

      However, after first trade the Stop & target submission is changed to "By Strategy Position" automatically and profit and stops are duplicating again.
      Why is happening this?​
      Last edited by lju45; 10-03-2022, 07:49 AM.

      Comment


        #4
        Hello lju45,

        Are you connecting TD Ameritrade?

        If you connect to the Simulated Data Feed does the behavior occur?

        What version are you using? (Help -> About)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          No, I'm using Kinetik:
          Click image for larger version  Name:	image.png Views:	0 Size:	157.7 KB ID:	1217914

          Version:
          Click image for larger version  Name:	image.png Views:	0 Size:	47.7 KB ID:	1217915


          I connect to the simulated fee it seems to respect PerEntryExecution and does it perfectly. ​

          Last edited by lju45; 10-04-2022, 03:46 AM.

          Comment


            #6
            Hello lju45,

            Could you create a simple test strategy that demonstrates the problem so that we can test this on our end between Kinetick and the simulated data feed?

            It would be best to make the strategy return for historical bars and then submit the orders in question in a similar way in realtime to make the issue happen. We can then use that for testing on our end and if there is a problem we can submit a bug report.



            Comment


              #7
              Hello,

              Finally, after multiple tests, I had to downgrade to the NinjaTrader version 8.0.22.2.

              My conclusion is that in this version it works in both Simulated and real connection (Kinetik), however for the higher NinjaTrader version it does not work in either (neither simulated nor real).
              So I clarify my previous comment, the only version that works is 8.0.22, any higher version does not respect the PerEntryExecution and automatically changes it.

              I hope you guys can check the higher version and fix it soon.

              Thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              56 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              132 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              73 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X