Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

basic stop loss question

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

    basic stop loss question

    how do I add a stop loss to my code below, that will place a stoploss 10 ticks below my long entry price? I want a 10 tick profit target which works and I want a 10 tick stop loss below my entry price? help please!

    EnterLong(DefaultQuantity, "");
    profitfactor = 2;
    EntryPrice = Position.AvgPrice;
    Print(EntryPrice);
    SetProfitTarget(CalculationMode.Ticks, 10);

    #2
    James, you can work with SetStopLoss() in the Initialize() if you want a static 10 tick stop - http://www.ninjatrader-support.com/H...tStopLoss.html

    Comment


      #3
      I was after the code to be honest, not an example sorry do you have the line of code?

      Comment


        #4
        Just add SetStopLoss(CalculationMode.Ticks, 10) in the Initialize() of your strategy.

        Comment


          #5
          how do I make a stop loss that will stop when

          market entry price - profitfactor * ATR(22)[0];

          the code is below,

          EnterLong(DefaultQuantity, "");
          profitfactor = 2;
          EntryPrice = Position.AvgPrice;
          Print(EntryPrice);
          SetProfitTarget(CalculationMode.Ticks, 10);

          Comment


            #6
            Hello,

            One way to do this is to change the StopLoss in OnBarUpdate then instead of just changing it to 10 ticks you would change it to the value you have calculated you want the stop to be at and then put this in manually to SetStopLoss(CalculationMode.Price, Price you want stop at);
            BrettNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            88 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            48 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            31 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            34 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            68 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X