Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Serial SetStopLoss / SetProfitTargets fail

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

    Serial SetStopLoss / SetProfitTargets fail

    Hi there, I'm unable to fire off sequential EnterLongLimit, when the Loss/Profit is set differently. For instance, this code works:

    SetStopLoss("MyStrat1", CalculationMode.Ticks, 13, false);
    SetProfitTarget("MyStrat1", CalculationMode.Ticks, 5);
    entryOrder = EnterLongLimit(0, true, 1, Close[0], "MyStrat1");
    entryOrder2 = EnterLongLimit(0, true, 1, Close[0], "MyStrat1");

    That is, both entryOrder and entryOrder2 fire off and execute. However, when I run the code as:

    SetStopLoss("MyStrat1", CalculationMode.Ticks, 13, false);
    SetProfitTarget("MyStrat1", CalculationMode.Ticks, 5);
    entryOrder = EnterLongLimit(0, true, 1, Close[0] , "MyStrat1");

    SetStopLoss("MyStrat2", CalculationMode.Ticks, 13, false);
    SetProfitTarget("MyStrat2", CalculationMode.Ticks, 5);
    entryOrder2 = EnterLongLimit(0, true, 1, Close[0], "MyStrat2");

    then only the EnterLongLimit, of entryOrder fires. The second EnterLongLimit, for entryOrder2, always fails.


    Your thoughts? Thanks,

    #2
    Set this to 2.




    Originally posted by timmbbo View Post

    SetStopLoss("MyStrat1", CalculationMode.Ticks, 13, false);
    SetProfitTarget("MyStrat1", CalculationMode.Ticks, 5);
    entryOrder = EnterLongLimit(0, true, 1, Close[0] , "MyStrat1");

    SetStopLoss("MyStrat2", CalculationMode.Ticks, 13, false);
    SetProfitTarget("MyStrat2", CalculationMode.Ticks, 5);
    entryOrder2 = EnterLongLimit(0, true, 1, Close[0], "MyStrat2");

    then only the EnterLongLimit, of entryOrder fires. The second EnterLongLimit, for entryOrder2, always fails.


    Your thoughts? Thanks,

    Comment


      #3
      I'm confused where in the code this would even be. You must be using the guide version without unlocked code. I want to help, but I don't understand what this does =( ... (always write in code).

      Like what does the "false" refer to, or the "0, true, 1?

      Clearly, you already allow multiple entries by direction, since both of your long entries happen, I just wonder - I think you have to make two strategies if you want two executions to happen.

      Like I have multiple different entries and exits, but they are ALL wrapped up within just a single strategy - it is one extensive file with thousand lines of code.

      Comment


        #4
        Hello timmbbo,

        Thanks for your post.

        As member sledge advised you want to work with your settings of Entries per direction as well as Entry handling settings. Using your second set of code, you can set the entries per direction to 1 and the entry handling of UniqueEntries. The UniqueEntries are defined by your signal names.

        member lmatiukas, here is a link to the helpguide section on EnterLongLimit thjat defines the parameters you are questioning: https://ninjatrader.com/support/help...rlonglimit.htm

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X