Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        838 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,294 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X