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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    72 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X