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 RookieTrader, Today, 09:37 AM
        4 responses
        17 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        2 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        38 views
        0 likes
        Last Post love2code2trade  
        Started by alifarahani, Today, 09:40 AM
        2 responses
        14 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by junkone, Today, 11:37 AM
        3 responses
        21 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X