Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Targets in Strategy Builder + Trailing Stops

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

    Multiple Targets in Strategy Builder + Trailing Stops

    Almost feel like a pest but I do search for these things and don't always find the info ​.... I've tagged this one to hopefully aid in that and shall do so from now on...

    To wit:
    Summary: I am wanting to simplify the algo by minimizing if possible the number of condition sets in the 'Conditions and Actions' window by combining separate target group conditions into one set. Possible?

    1. I have 4 target settings and each have their own designator; i.e. Long_1, Long_2, Long_3, etc. and conversely for shorts.

    2. The objective is to use 1 'Set' in the conditions and actions window using 4 conditional groups. The reason for 4 is because I am using boolean conditionals (on/off) for each target in user settings and hence I assume each entry needs separate permission for entry.
    Note: All 4 conditional groups in this Conditions and Actions window (Set 1) have exactly identical requirements for entry, the sole difference being each target group has its own on/off switch in user settings, so "Use_Target_1, Use_Target_2, Use_Target_3" etc...

    3. I am aware each entry need have it's own designator (as above). So examine the picture attached and see what I'm up to; I'm curious to see if I can avoid having to create 16 different sets to accommodate each designated entry. As in the picture, the primary Set window is set to "If Any", whereas the individuals of course are set to "If All".


    4. Down below, The 'Do the following' window does not have if/then capability. I assume thus any action entered is executed. So if so then another possible arises:

    5. What happens if my target contract is set to zero?
    Explaining: In user settings I have Contracts_1st_Target which pairs with Target_1, Contracts_2nd_Target which pairs with Target_2, etc.

    Since this is a C# construct, is it not possible that I can simply use the one conditional statement for entry (since all are equal except for bool switches)?
    Can I not just set non-used contracts and targets to zero in user settings and go ahead and add all four separate entry executions in the 'Do the Following' window?
    Out on a limb here, but I'm thinking that if the entry execution line sees a zero setting would the system realize 'not being used thus ignore'?

    6. Multiple Targets I know have to be assigned open entry designators. I assume you have a link you can add here for this? Also needing Trailing stop instruction (link please) in this environ. If it matters, the trailing system will apply to all active entries equivalently, as I know how the DOM will react.

    Thanx
    JM

    #2
    Hello johnMoss,

    Thank you for your note.

    It's a bit hard to follow what you're attempting to do from the screenshot and your description, however, if you have different entries you would generally need different condition sets as there is no if/then for the "Do the following". Think of the Conditions as the "If" and the "Do the following as the "Then" of the set. Further, submitting orders with a 0 quantity will result in the system modifying those to submit a 1 quantity.

    I'm also not sure what you mean by "Multiple Targets I know have to be assigned open entry designators" - are you referring to using Signal Names to link the target with the entry it is to exit? If so, yes, you would want to use signal names for the entry and assign that as the From Entry Signal name for the stop/target intended to close out that entry, yes. I would suggest reviewing this documentation on order submission with the managed approach as this goes over the use of signal names:



    As far as a trailing stop example, I've attached a basic example using SetTrailStop and a more complex example showing how to create a trailing stop functionality using exit orders that allows the user to control the frequency and distance of the trail.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment


      #3
      Thank You Kate,
      The primary question is answered, i.e. separate entry systems must be in place for separate entry designations. I shall review your links.
      JM

      Comment


        #4
        "As far as a trailing stop example, I've attached a basic example using SetTrailStop and a more complex example showing how to create a trailing stop functionality using exit orders that allows the user to control the frequency and distance of the trail."

        I will be checking these out, i'm having some difficulty in setting the Trailing stop.

        I want my trailing stop to be conditional, meaning, only active if I have taken my first profit. Then I want it to be active until the trade closes.

        I did this in a "set" that basically says

        //defined in strategy builder that is generally set high enough not to interfere with the strategy.
        Trail_Stop_init = 1000;

        If(Unrealized profit > ## )
        {
        Exit half position

        //Trail _Stop_active is a user input.
        Trail_Stop_init = Trail_stop_active;

        }

        However, I am thinking the trailing stop would only be active if Unrealized profit is greater than ###. After the sell I have no idea if my trail stop is active any more or what its value is. Any ideas?

        I had one instance where the trailing stop was supposed to be 100 ticks and it went almost 30points against me! lol If that had been real time talk about bad!
        Last edited by RISKYBUSINEZZ; 11-04-2022, 12:37 PM.

        Comment


          #5
          Hi RISKYBUSINEZZ, thanks for posting. The best way to find out what your strategy is doing is to add Print to your Actions list and print out data from the strategy. You can also add a new Set with no conditions, and add prints to that action list to print out data on each bar to print things like Unrealized PnL. Within Print, you will see that you can set the string output to any indicator, price, or variable value. This will be the most effective way to debug.

          https://ninjatrader.com/support/help...script_cod.htm

          Kind regards,
          -ChrisL

          Comment

          Latest Posts

          Collapse

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