Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnOrderUpdate

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

    OnOrderUpdate

    If I use Exit methods (OnOrderUpdate) instead of Set methods, how do I direct the Exit order to the single tick data series?

    I know I add: AddDataSeries(Data.BarsPeriodType.Tick, 1);

    stopOrder = ExitLongStopMarket(1,0, true, execution.Order.Filled, execution.Order.AverageFillPrice - (StopPoints * (4 * TickSize)), "LongStop", "LongEntry");

    #2
    Hello AdeptistJune,

    Thank you for your post.

    Keep in mind the Strategy Position is driven by executions and cannot Exit more than the strategy Position size. It would be best to use OnExecutionUpdate for Exits instead of OnOrderUpdate due to this. This example from the help guide demonstrates:



    In that particular example there isn't an added secondary series so the orders would be placed on the primary series. Looks like you do have the correct syntax in your code sample you provided to submit the stop order to the secondary series - using 1 as the first parameter would tell the strategy to place the order on the first added data series (your tick series).

    Please let us know if we may be of further assistance to you.


    Comment


      #3
      Here's the correct syntax:

      if (execution.Order.OrderState == OrderState.PartFilled)
      {
      stopOrder = ExitLongStopMarket(1, true, execution.Order.Filled, execution.Order.AverageFillPrice - (StopPoints * (4 * TickSize)), "LongStop", "LongEntry"); // 15
      targetOrder = ExitLongLimit(1, true, execution.Order.Filled, execution.Order.AverageFillPrice + (TargetPoints * (4 * TickSize)), "LongTarget", "LongEntry"); // 18

      stopOrder = ExitShortStopMarket(1, true, execution.Order.Filled, execution.Order.AverageFillPrice + (StopPoints * (4 * TickSize)), "ShortStop","ShortEntry");
      targetOrder = ExitShortLimit(1, true, execution.Order.Filled, execution.Order.AverageFillPrice - (TargetPoints * (4 * TickSize)), "ShortTarget","ShortEntry");
      }

      My goal is to get the backtest to match real time results as close as possible.

      I added a 1 tick data series: AddDataSeries(Data.BarsPeriodType.Tick, 1);

      I execute trades using the 1 tick data series: EnterLong(1,1, "LongEntry");

      I exit trades using the 1 tick data series: targetOrder = ExitLongLimit(1, true, execution.Order.Filled, execution.Order.AverageFillPrice + (TargetPoints * (4 * TickSize)), "LongTarget", "LongEntry");

      My primary chart series is a 100 tick chart

      In the backtest, I can't use Order Fill Resolution because of the added data series.

      Can you help me understand what I'm missing? Thanks.

      Comment


        #4
        Hello AdeptistJune,

        Thank you for your reply.

        I'd take a look at this example script, it should get you going in the correct direction.

        Please let us know if we may be of further assistance to you.
        Attached Files

        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