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 ETFVoyageur, 04-30-2024, 02:04 PM
        13 responses
        109 views
        0 likes
        Last Post ETFVoyageur  
        Started by Skifree, Today, 11:21 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
        52 responses
        5,265 views
        0 likes
        Last Post olivierh  
        Started by ssijbabu, 10-07-2012, 07:10 AM
        6 responses
        4,430 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by iceman2018, Today, 10:39 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X