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 CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            26 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            26 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-25-2026, 09:53 PM
            0 responses
            30 views
            0 likes
            Last Post CaptainJack  
            Started by CaptainJack, 03-25-2026, 09:51 PM
            0 responses
            18 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 03-23-2026, 11:13 AM
            0 responses
            29 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X