Support Board
Date/Time: Tue, 04 Mar 2025 18:19:15 +0000
[Programming Help] - Difference in result at different Replay speed
View Count: 762
[2021-12-24 10:01:48] |
sushant - Posts: 32 |
The results are correct till 120X but it is incorrect at 240. At 240X the study gets stuck and doesn't work properly. What could be the cause of it and how to fix it. The code how we update the stop loss is provided below: void StopUpdate(int OrderId,int StopUpdateStatus,float offset,float MaxStopPrice,SCStudyInterfaceRef sc) { if( StopUpdateStatus == STOP_UPDATE_NONE ) return ; s_SCNewOrder ModifyOrder; ModifyOrder.InternalOrderID = OrderId; s_SCTradeOrder mktStopDetails; if (sc.GetOrderByOrderID(OrderId, mktStopDetails) && mktStopDetails.OrderStatusCode == SCT_OSC_OPEN) { if( StopUpdateStatus == STOP_UPDATE_HIGH) ModifyOrder.Price1 = min(sc.High[sc.Index] + offset , MaxStopPrice); else if(StopUpdateStatus == STOP_UPDATE_LOW) ModifyOrder.Price1 = max(sc.Low[sc.Index] - offset , MaxStopPrice); else if(StopUpdateStatus == STOP_UPDATE_POC_LONG) ModifyOrder.Price1 = max(CalcPOCGeneral(sc,sc.Index) - (1 * sc.TickSize) , MaxStopPrice); else if(StopUpdateStatus == STOP_UPDATE_POC_SHORT) ModifyOrder.Price1 = min( CalcPOCGeneral(sc,sc.Index) +(1 * sc.TickSize),MaxStopPrice); SCString msg; if(sc.ModifyOrder(ModifyOrder) == 1) { SCString msg; msg.Format("Stop Updated at price %f" , ModifyOrder.Price1); sc.AddMessageToLog(msg,1); } else { msg.Format("STOP UPDATE Failed STATUS: %d",StopUpdateStatus); sc.AddMessageToLog(msg,1); } } } Here depending on the user setting we decide how to modify/trail the stop. Is it possible that the due to the replay speed the prices are moving faster than the update of the stop loss causing the issue and differences. How to do it so we get consistent results across all the relay speed Date Time Of Last Edit: 2021-12-24 11:00:29
|
![]() ![]() |
[2021-12-24 10:03:36] |
sushant - Posts: 32 |
Here is the code how we update the stop is there any change that can fix it.
|
![]() |
[2021-12-24 14:15:20] |
Sawtooth - Posts: 4179 |
How to do it so we get consistent results across all the relay speed
From my experience, it's not always possible.To some degree, replay speed will always affect results. It takes time for an autotrader to move stops, so if the replay speed exceeds those intervals, things get skipped. If you get accurate results at 120x, but not at 240x, then use 120x. |
[2021-12-24 16:42:33] |
User99735 - Posts: 234 |
Check out thread Replay - Different filled prices in different speeds Will need to look at full code ie the calling code where StopUpdate() is called, etc, to comment. |
To post a message in this thread, you need to log in with your Sierra Chart account: