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 GLFX005, Today, 03:23 AM
        0 responses
        1 view
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        11 views
        0 likes
        Last Post XXtrader  
        Started by Waxavi, Today, 02:10 AM
        0 responses
        6 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        11 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Working...
        X