Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss not reseting

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

    SetStopLoss not reseting

    My strategy performs works fine in test mode (see Strategy Result.png).

    In realtime the strategy gets stuck at the first SetStopLoss (see Pending Submit.png). I had to bail out of the strategy and then this pending order is also stuck. Had to disconnect to clear.

    I call several SetStopLoss resets after the inital one. Works in testing not realtime.
    if (Position.MarketPosition == MarketPosition.Flat
    {
    EnterLong();
    SetStopLoss(CalculationMode.Price, Low[
    0]);
    }

    if (Position.MarketPosition == MarketPosition.Long)
    {
    stop = Position.AvgPrice - 3*TickSize;
    SetStopLoss(CalculationMode.Price, stop);

    if (EMA(21)[0] > stop )
    {
    stop = Instrument.MasterInstrument.Round2TickSize(EMA(
    21)[0]-1*TickSize);
    SetStopLoss(CalculationMode.Price, stop);
    }

    if ( (Low[0] - 2*TickSize) > Position.AvgPrice )
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice +
    1*TickSize);
    }

    if ( (High[0]) > Position.AvgPrice + 15*TickSize )
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice +
    3*TickSize);
    }

    if ( (High[0]) > Position.AvgPrice + 30*TickSize )
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice +
    5*TickSize);
    }
    }

    Strategy Print Statements just before stategy closes
    *******************Time[0] 2/4/2011 6:51:00 AM
    Vol 68000
    Close[0] 14.52
    Avg price 14.46
    1st stop 14.43
    2nd stop 14.46
    3rd stop 14.46
    Last stop 14.46
    Attached Files
    Last edited by maxsys; 02-05-2011, 01:12 PM. Reason: Add attachments

    #2
    maxsys, are you testing this on a real account? If so, I would highly recommend testing on Sim101 until you get the bugs worked out. You may want to add elses to the ifs because they will all be checked and changed according to which one is true furthest down the line.
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 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