Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Stop Losses

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

    Moving Stop Losses

    I'm trying to move stop losses by their individual IOrder entries... currently I'm using the Position.AvgPrice in order to move my stop losses to break even as shown below...
    Code:
                // LONG ORDER BREAKEVEN STOPLOSS
                if (Position.MarketPosition == MarketPosition.Long && GetCurrentAsk() >= Position.AvgPrice + 3 * TickSize)
                {
                    if (longstopOrderA != null && longstopOrderA.StopPrice < Position.AvgPrice)
                    {
                        longstopOrderA = ExitLongStop(0, true, longstopOrderA.Quantity, Position.AvgPrice + 1 * TickSize, "LongStopA", "LongA");
                    }
                    
                    if (longstopOrderB != null && longstopOrderB.StopPrice < Position.AvgPrice)
                    {
                        longstopOrderB = ExitLongStop(0, true, longstopOrderB.Quantity, Position.AvgPrice + 1 * TickSize, "LongStopB", "LongB");
                    }
                    
                    if (longstopOrderC != null && longstopOrderC.StopPrice < Position.AvgPrice)
                    {
                        longstopOrderC = ExitLongStop(0, true, longstopOrderC.Quantity, Position.AvgPrice + 1 * TickSize, "LongStopC", "LongC");
                    }
                }
    but I want to be able to adjust the stoploss for each order individually based on the fill price for each order, rather than an avg position price... I've tried doing something like the following, but am having no luck at all, the stops are not moved once placed... would really appreciate any assitance...

    Code:
                // LONG ORDER BREAKEVEN STOPLOSS
                if (Position.MarketPosition == MarketPosition.Long)
                {
                    if (longstopOrderA != null && longentryOrderA.AvgFillPrice + 3 * TickSize <= GetCurrentAsk())
                    {
                        longstopOrderA = ExitLongStop(0, true, longstopOrderA.Quantity, longentryOrderA.AvgFillPrice + 1 * TickSize, "LongStopA", "LongA");
                    }
                    
                    if (longstopOrderB != null && longentryOrderB.AvgFillPrice + 3 * TickSize <= GetCurrentAsk())
                    {
                        longstopOrderB = ExitLongStop(0, true, longstopOrderB.Quantity, longentryOrderB.AvgFillPrice + 1 * TickSize, "LongStopB", "LongB");
                    }
                    
                    if (longstopOrderC != null && longentryOrderC.AvgFillPrice + 3 * TickSize <= GetCurrentAsk())
                    {
                        longstopOrderC = ExitLongStop(0, true, longstopOrderC.Quantity, longentryOrderC.AvgFillPrice + 1 * TickSize, "LongStopC", "LongC");
                    }
                }

    #2
    BigDog008, have you printed ou the entry IOrder values so they actually hold the fill prices you would expect? Wouldn't you need to check for the entryprice being greater then the ask + 3 ticks to move the stops? Maybe the condition never hits home to activate this stop movement in the second case.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    63 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    54 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    61 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Working...
    X