Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategies do not place orders when they should.

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

    Strategies do not place orders when they should.

    Hello,

    I am running a strategy on playback connection for testing purposes on the ES S&P 500 Mini 15 minute bar chart.

    Below shows my logic for submitting an order.

    ---------------------------------------------------------------------
    if (State == State.SetDefaults)
    {
    Calculate.OnEachTick;
    ShortStopTicks = 4;
    }

    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Minute, 15);
    SetStopLoss("SSEntry", CalculationMode.Ticks, ShortStopTicks, false);
    }

    protected override void OnBarUpdate()
    {
    Benchmark = Open[0];

    if ((GetCurrentAsk(1) == Benchmark)
    || (GetCurrentBid(1) == Benchmark))
    {
    EnterLongStopMarket(0,true,Convert.ToInt32(OrderQu antity), Benchmark + 1, "LSEntry");
    }
    ---------------------------------------------------------------------

    When a new 15 minute bar appears, the strategy captures the open price of that bar and stores it as "Benchmark". So if current bid or ask == Benchmark, then place long stop order one point above Benchmark.

    When the order is placed and the market reaches my entry, a stop loss is placed 4 ticks below, which essentially is the same price of "Benchmark". If the market comes back down to touch my stop, the strategy should place the same order again after I am stopped because it has also touched benchmark again. It does not happen all the time, but sometimes the order is not placed again when the market comes to touch my stop while still touching "Benchmark" within that same second.

    At first I thought the market was probably just jumping over my "Benchmark" value which caused the orders to not be placed but I zoomed into the one tick chart and saw that the market touched my Benchmark multiple times.

    My hunch is that the data I am receiving updates by the second, and if the market touches my stoploss/ "benchmark" value, say at 8:30:01, the strategy will perform the stoploss exit first only within that second will not perform the submit order method unless the market is still touching my "Benchmark" at 8:30:02.

    This happening has cause me to miss out on important trades.
    Do you have any insight as to why this is happening?

    #2
    Hello Don22Trader1,

    There are two possible scenarios when an expected action is not taken.

    1. The expected action was not allowed by the logic, and the action was not reached
    2. The expected action was ignored (could be due to internal order handling rules, or EntryHandling/EntriesPerDirection settings, etc.)

    To confirm, we would add prints beside the action, retest, and confirm the action is met when it is expected to be met.

    If the action is met and no action takes place, test again with TraceOrders enabled, which will tell you if the order was ignored.

    If the action is not met, you will would need to use debugging prints to check the values used in the condition controlling the action, and print those values before the condition gets evaluated.

    Keep in mind that when a strategy is yellow in the Control Center, it means it is waiting until the virtual strategy position becomes flat before it can take a live action with realtime data.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm

    Internal Rules of the Managed Approach - https://ninjatrader.com/support/help...antedPositions

    EntryHandling - https://ninjatrader.com/support/help...ryhandling.htm

    EntriesPerDirection - https://ninjatrader.com/support/help...rdirection.htm

    Please continue testing in the Playback Connection and use debugging prints and Trace Orders to confirm that the action is getting reached and to see if the order is ignored.

    If you have questions on the TraceOrders output, please let us know.



    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 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
    70 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