Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss doesn't work with "fromEntrySignal"

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

    SetStopLoss doesn't work with "fromEntrySignal"

    Hello, if I use SetStopLoss only with two parameters (CalculationMode mode, double value) it woks correctly. But if I use SetStopLoss with four parameters (fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop) the stop order is fixed in a incorrect level. I have made a lot of tests checking this issue. How can I solve it? Thanks in advance.

    #2
    Hello soyjesus,

    Thanks for your post.

    Please provide a reduced example script and the steps to replicate, that demonstrates the issue you are observing.

    Comment


      #3
      Hello Paul,

      Thank you for your help. This mi code:

      a) SetStopLoss(EtiquetaEntradaCorta, CalculationMode.Ticks, Ticks_StopMax, false);

      b) SetStopLoss(CalculationMode.Ticks, Ticks_StopMax);

      The variable "EtiquetaEntradaCorta" is a string with the name of the strategy and the currentbar.

      The variable "Ticks_StopMax" is a double.

      Comment


        #4
        Hello soyjesus,

        Thanks for your reply.

        I am asking for a working strategy that has only the code used to demonstrate the issue and the steps to recreate the issue (Instrument, bar type, time frame, Live/replay/strategy analyzer).

        Thanks in advance.

        Comment


          #5
          Thanks for your reply. I'm trying to find the issue with a new code more simplificated.

          Comment


            #6
            Hello soyjesus,

            Thanks for your reply.

            From your original description, I suspect the issue is related to the string name used so you may want to verify the entry order name exactly matches the entry name used in the SetStopLoss.


            Comment


              #7
              Hello Paul,

              The issue continues. I attach a sample. When I use "SetStopLoss" without fromEntrySignal name, it works ok. But when I use the parameter "fromEntrySignal name" it doesn' work.

              Thanks in advance for your help.

              Attached Files

              Comment


                #8
                Hello soyjesus,

                Thanks for your reply.

                In your example, you are already assigning a setstoploss order in the same block where you are placing the enter long order. Later you are trying to add another setstoploss with the order name but this will not work because the first setstoploss is in place and only one stoploss per order is possible.

                Here is an example of how you use signal names:

                if (EntryConditions are true)
                {
                SetStopLoss ("MySignalName", CalculationMode.Ticks, 20, false); // always set the stop/profit values first to ensure they are ready
                SetProfitTarget("MySignalName", CalculationMode.Ticks, 20);
                EnterLong("MySignalName");
                }

                if (conditions to adjust the stoploss)
                {
                SetStopLoss("MySignalName", CalculationMode.Price, Low[0] - 5 * TickSize, false);
                }

                Comment


                  #9
                  Ok, but I need to change the level of stop-loss when the price reach a level. So I need to begin with a level stop and after to change this level. How can I do it?

                  Comment


                    #10
                    Hello soyjesus,

                    Thanks for your reply.

                    The example I showed in Post #8 starts with a stop loss at 20 ticks from the entry. Then I adjust the stop loss (when "conditions to adjust the stoploss" becomes true) to a price based value of the Low[0] price - 5 ticks.





                    Comment

                    Latest Posts

                    Collapse

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