Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

error handling with strategy NON ATM

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

    error handling with strategy NON ATM

    I used a Try and Catch to keep the strategy going but I still get this error in the picture below. This is my logic. Is it the Slippage giving me this error?




    try
    {
    if(Close[0] > Open[0] + 5*TickSize)
    {
    EnterShortStopMarket(nNumberOfSetContracts, nEntryPrice, "Short1");
    SetStopLoss("Short1", CalculationMode.Ticks, 11, false);
    SetProfitTarget("Short1", CalculationMode.Ticks, 10);

    EnterShortStopMarket(nNumberOfContractsRunner,nEnt ryPrice,"Short2");
    SetTrailStop("Short2", CalculationMode.Ticks, 18, false);


    nCount = 0;
    }
    }
    catch
    {

    EnterShort(nNumberOfSetContracts, "Short1");
    SetStopLoss("Short1", CalculationMode.Ticks, 11, false);
    SetProfitTarget("Short1", CalculationMode.Ticks, 10);

    EnterShort(nNumberOfContractsRunner,"Short2");
    SetTrailStop("Short2", CalculationMode.Ticks, 18, false);
    nCount = 0;



    }
    Attached Files

    #2
    Hello ballboy11,

    Thank you for your note.

    I would not expect this to be related to slippage but rather the price at which you first submit your entershortstopmarkets. These orders should be placed below the market. It could be that you are submitting the order at a price so close to the best bid best ask that its being rejected.

    I would suggest adding a print to the script above your EnterShortStopMarket calls,

    Print("nEntryPrice="+nEntryPrice.ToString());
    Print("The Current Bid price is: " + GetCurrentBid());

    If you add those prints and run the script in real time, does it become clear why the orders are being rejected?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    58 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    46 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    37 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    156 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X