Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss issue

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

    Stop Loss issue

    Hi Josh

    I'm having a small issue with SetStopLoss. I calculate dynamically my Stop Loss and I'm using the following code in OnBarUpdate():

    // Stop Loss Long
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    SetStopLoss(
    "Long", CalculationMode.Price, StopLossLong, false);
    }
    elseif (Position.MarketPosition == MarketPosition.Long
    && Position.GetProfitLoss(Close[
    0], PerformanceUnit.Currency) > ATR(24)[0])

    {
    SetStopLoss(
    "Long", CalculationMode.Price, Position.AvgPrice, false);
    ExitL =
    false;
    }

    I'm copying here a small part of the output file, which is:
    Print(Time[0] + " " + Close[0] + " " + StopLossLong + " " + StopLossShort + " " + Position.MarketPosition)

    As you can see below, at 12.30 I go Long. At 13.00 the close is 0.8339, while the StopLossLong is 0.8343 (approximated). The Stop Loss doesn't kick in! Why?

    Thank you

    11/28/2008 12:00:00 PM Entered internal PlaceOrder() method at 11/28/2008 12:00:00 PM: Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Long' FromEntrySignal=''
    11/28/2008 12:00:00 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Long' Mode=Price Value=-0.00139086260765518 Currency=0 Simulated=False
    11/28/2008 12:00:00 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Short' Mode=Price Value=0.84 Currency=0 Simulated=False
    11/28/2008 12:00:00 PM 0.8356 -0.00139086260765518 0.84 Flat
    11/28/2008 12:30:00 PM 0.8351 0.83427542333433 0.8384 Long
    11/28/2008 1:00:00 PM 0.8339 0.8342722806954 0.8383 Long
    11/28/2008 1:30:00 PM 0.8339 0.834206768999758 0.837193231000242 Long
    11/28/2008 2:00:00 PM 0.8305 0.834043986958102 0.837356013041898 Long
    11/28/2008 2:30:00 PM 0.8308 0.834042154168181 0.837357845831819 Long

    #2
    stefy,

    You are in a long position. You cannot submit a stop loss order at a price above the market.

    I suggest you track out at what price your entry order was filled and what the exact market price was the moment you submitted the stop loss modification.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X