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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X