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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            111 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            158 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            78 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            125 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            79 views
            0 likes
            Last Post PaulMohn  
            Working...
            X