Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stop loss and profit target

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

    stop loss and profit target

    Hi
    I want to create a new automatic strategy; I have an important question:

    Can I place a pending order (Sell STP) or (Buy STP) with stop loss and profit target directly, I mean it should be put together at the same time immediately?
    I do not want stop loss and profit target to be placed after the pending order is triggered, it should be placed before the pending order is triggered.
    Can this be done by programmer?
    Hope my question is clear


    #2
    Hello Trader199,

    For strategy based targets using the managed approach which is the approach used most commonly and by the strategy builder that would not be possible. Targets are tied to the entry order which is an addition protection to avoid unwanted positions. A simple example would be that the price rapidly moves away from the entry price hitting a target which enters a position, if the price comes back to the entry price it will hit the entry and do the opposite of what you had intended.

    This is something you could do using the unmanaged approach however you would also need to add logic to track all orders and make sure the trades work specifically as intended. You are introducing additional problems/risk by having future orders working before they are actually needed.


    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello Trader199,

      For strategy based targets using the managed approach which is the approach used most commonly and by the strategy builder that would not be possible. Targets are tied to the entry order which is an addition protection to avoid unwanted positions. A simple example would be that the price rapidly moves away from the entry price hitting a target which enters a position, if the price comes back to the entry price it will hit the entry and do the opposite of what you had intended.

      This is something you could do using the unmanaged approach however you would also need to add logic to track all orders and make sure the trades work specifically as intended. You are introducing additional problems/risk by having future orders working before they are actually needed.


      Thank you very much for the clarification,
      Actually, I'm asking this question because I have a problem and I couldn't find the right solution for it.
      I will explain the problem to you and hope that you can point me to the correct solution for it.
      I have created a new strategy using (ATM), and now am testing it only on playback connection (with max speed), the strategy depends on placing the pending order (Sell STP) and (Buy STP).
      After the pending order is activated:
      A. Sometimes I get this message. (the next picture):

      Click image for larger version

Name:	Error 1.png
Views:	275
Size:	4.6 KB
ID:	1203533

      B. Sometimes I get this two message without closing the open trade. (the next picture):

      Click image for larger version

Name:	Error 2.png
Views:	289
Size:	12.1 KB
ID:	1203534



      I want these messages not to appear and I want the open trade to be closed at stop loos or profit target at the best possible price.
      What is the proper solution to this problem, I think a lot about it?
      Attached Files

      Comment


        #4
        Hello Trader199,

        For the OCO error if you have a specific set of syntax where you can reliably reproduce that in some way we can report it to development. I would suggest trying to use the SampleATMStrategy script without modifications and just edit the ATM template to be what you are using now, that would help to determine if this is being caused by the logic you are using or the template.

        For the other error if you are doing changes to target prices then you would need to ensure the price is valid when making that change, if you are not making changes and simply submitting the ATM that would also be a situation I would suggest to test using the SampleATMStrategy. If you see that and have steps to make a report we can send that over to development.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello Trader199,

          For the OCO error if you have a specific set of syntax where you can reliably reproduce that in some way we can report it to development. I would suggest trying to use the SampleATMStrategy script without modifications and just edit the ATM template to be what you are using now, that would help to determine if this is being caused by the logic you are using or the template.

          For the other error if you are doing changes to target prices then you would need to ensure the price is valid when making that change, if you are not making changes and simply submitting the ATM that would also be a situation I would suggest to test using the SampleATMStrategy. If you see that and have steps to make a report we can send that over to development.

          Thank you
          I have another question please:
          when I run the automatic strategy on playback connection
          If I run playback (with max speed) Is this a possible reason for these errors to appear?
          I didn't test it at low speeds (x1 x2 x4 x6 x8 etc.) because this would take a very long time, I just tested it on Max Speed.

          Comment


            #6
            Hello Trader199,

            The max speed should not affect scripted items like strategies or ATM's. If you are seeing an issue with that we would need details on what specific steps/template items are used so we could report that.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            53 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 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