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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X