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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X