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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,610 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        16 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X