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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X