Support Board
Date/Time: Sun, 15 Jun 2025 16:56:32 +0000
Post From: Help understanding Backtest Fills
[2025-05-29 01:47:01] |
Asad1939 - Posts: 4 |
Hi I'm wondering if you could help me understand how the logic for the following ordertype works. I have a market order with 2 attached orders. The first is a take profit 20 ticks away from the close price of the bar. The second is a trailing stop loss with initial stop loss of 5282.85 (ES points) and a trailing stop amount of 3.5 points. See the attached image for how the order exceutes in the back test. The green line shows the entry and exit points. I've given the outline of the ACSIL code for this order below. s_SCNewOrder order; order.OrderType = SCT_ORDERTYPE_MARKET; order.OrderQuantity = 1; order.TextTag = "ShortEntry"; order.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; // Attach target limit order (take profit) order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT; order.Target1Price = sc.Close[sc.Index] - 20 * sc.TickSize; // Attach a trailing stop loss (I've hard coded the values to make it easier to follow the example attached) order.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP; order.Stop1Price = 5282.85; order.TrailStopStepPriceAmount = 3.5; // points From my understanding under normal market situations it would be unusual to make more than 20 ticks with this order type (because the take profit is set at 20 ticks). However as you can see in the figure attached the closing order fills at almost 40 ticks. In my backtest there are many occurrences where the profit is well above 20 ticks. I don't understand why, shouldn't the take profit kick in if the P&L is at 20 ticks. I understand if the price jumped over the take profit level the TP order would not get executed, but this is not the case in any of the examples I see. Could you help me understand what's going on here? I'm running an "Autotrade System Bar Based Backtest". Date Time Of Last Edit: 2025-05-29 01:57:43
|
![]() |