Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Handling and V18

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

    Order Handling and V18

    I wanted to see wanted to see why would my strategies be entering multiple contracts, instead of just one per direction. This started last night with v18 and all ZenFire issues. I enter with just a, EnterLong(DefaultQuantity, ""); and EnterShort(DefaultQuantity, "");

    I do use the following too,
    Code:
    #region Breakeven and Trailing Stops
                // Resets the stop loss to the original value when all positions are closed
                   switch (Position.MarketPosition)
                {
                    case MarketPosition.Flat:
                        SetStopLoss(CalculationMode.Ticks, stopLossTicks);
                        previousPrice = 0;
                        break;
                    case MarketPosition.Long:
                        // Once the price is greater than entry price+ breakEvenTicks ticks, set stop loss to breakeven
                        if (Close[0] > Position.AvgPrice + breakEvenTicks * TickSize
                            && previousPrice == 0)
                        {
                            initialBreakEven = Position.AvgPrice + plusBreakEven * TickSize;
                            SetStopLoss(CalculationMode.Price, initialBreakEven);
                            previousPrice = Position.AvgPrice;
                            PrintWithTimeStamp("previousPrice = "+previousPrice);
                        }
                        // Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
                        else if (previousPrice    != 0 ////StopLoss is at breakeven
                                 && GetCurrentAsk() > previousPrice + trailProfitTrigger * TickSize
                            )
                        {
                            newPrice = previousPrice + trailStepTicks * TickSize;
                            SetStopLoss(CalculationMode.Price, newPrice);
                            previousPrice = newPrice;
                            PrintWithTimeStamp("previousPrice = "+previousPrice);
                        }
                        break;
                    case MarketPosition.Short:
                        // Once the price is Less than entry price - breakEvenTicks ticks, set stop loss to breakeven
                        if (Close[0] < Position.AvgPrice - breakEvenTicks * TickSize
                            && previousPrice == 0)
                        {
                            initialBreakEven = Position.AvgPrice - plusBreakEven * TickSize;
                            SetStopLoss(CalculationMode.Price, initialBreakEven);
                            previousPrice = Position.AvgPrice;
                            PrintWithTimeStamp("previousPrice = "+previousPrice);
                        }
                        // Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
                        else if (previousPrice    != 0 ////StopLoss is at breakeven
                                 && GetCurrentAsk() < previousPrice - trailProfitTrigger * TickSize
                            )
                        {
                            newPrice = previousPrice - trailStepTicks * TickSize;
                            SetStopLoss(CalculationMode.Price, newPrice);
                            previousPrice = newPrice;
                            PrintWithTimeStamp("previousPrice = "+previousPrice);
                        }
                        break;
                    default:
                        //autoStopA900Traded = false;
                        break;
                }
                #endregion
    but the trades are done back to back to back until margin is exceeded. The worse part is that it kills the strategy. My strategies were working just fine until last night.

    #2
    Please send me your log and trace files for today so that I may look into what occurred.

    You can do this by going to the Control Center-> Help-> Mail to Support.

    Please reference the following ticket number in the body of the email: http://www.ninjatrader.com/support/f...ad.php?t=62834
    LanceNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X