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 cmoran13, Yesterday, 01:02 PM
    0 responses
    29 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    21 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    95 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    148 views
    2 likes
    Last Post CaptainJack  
    Working...
    X