Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Losses

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

    Stop Losses

    Hi everyone
    I want to apply a stop loss using the ATR(14).
    I wrote the following code:
    // Condition set Long Stop Loss
    if (Close[0] < (Position.AvgPrice - ATR(14)[0])
    && Position.MarketPosition == MarketPosition.Long)
    {
    ExitLong(
    "STOPLOSS", "BUY");
    }

    Problem is, the stop loss never kicks in!

    Any advice?

    Thank you

    #2
    Hi Stefy,

    Is "BUY" the same "fromentrysignal" used in the EnterLong() function? If not, that would cause the problem you are seeing...

    Comment


      #3
      Originally posted by Gumphrie View Post
      Hi Stefy,

      Is "BUY" the same "fromentrysignal" used in the EnterLong() function? If not, that would cause the problem you are seeing...
      Thank you, Gumphrie! That was the problem indeed.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, Yesterday, 01:02 PM
      0 responses
      31 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      22 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      95 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      151 views
      2 likes
      Last Post CaptainJack  
      Working...
      X