Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

help on SetProfitTarget/StopLoss/TrailStop

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

    help on SetProfitTarget/StopLoss/TrailStop

    Hi,

    I'm trying to do this with one cancel another if filled:

    a. Set profit target at 300 pips
    b. Set initial stop loss at 50 pips (upon entry, it goes up/down 50pips)
    c. Set trailing stop loss at 100 pips (after it runs)

    I uses the following commands:

    SetTrailStop("EntSet1", CalculationMode.Ticks, 100, false);
    SetProfitTarget(
    "EntSet1", CalculationMode.Ticks, 200);
    SetStopLoss(
    "EntSet1", CalculationMode.Ticks, 50, false);

    However, it ignored the SetTrailStop and only recognize the SetStopLoss. If I take away, SetStopLoss, then SetTrailStop will work. Is it posible to have all 3 work together?

    Regards,
    Toyogo

    #2
    Unfortunately you cannot use SetStopLoss and SetTrailStop simultaneously on the same order. To do what you want will require you to use SetStopLoss, but modifying the order as it starts running. Please see these reference samples: http://www.ninjatrader-support.com/v...ead.php?t=3222


    The solution is a bit more on the complex end.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thanks. another question:

      How can I run two sets of entries and setstoploss with both sets of entries are active? eg.

      protectedoverridevoid Initialize()
      {
      SetProfitTarget("EntSet1", CalculationMode.Ticks, 200);
      SetStopLoss("EntSet1", CalculationMode.Ticks, 100, false);

      SetProfitTarget("EntSet2", CalculationMode.Ticks, 100);
      SetStopLoss("EntSet2", CalculationMode.Ticks, 50, false);
      }

      protectedoverridevoid OnBarUpdate()
      {
      if (cond1)
      EnterLongLimit(DefaultQuantity, 1.4625, "EntSet1");

      if (cond2)
      EnterLongLimit(DefaultQuantity, 1.4732,"EntSet2");
      }

      Comment


        #4
        You will need to increase the EntriesPerDirection to 2. Alternatively you can change EntryHandling to EntryHandling.UniqueEntries. Please see: http://www.ninjatrader-support.com/H...yHandling.html

        Then what you have outlined there will be needed; you need to specify unique entry names and link your SetStopLoss()/SetProfitTarget() sets to their entry names.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        27 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        117 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        69 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        226 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        414 views
        0 likes
        Last Post CaptainJack  
        Working...
        X