Support Board
Date/Time: Tue, 04 Mar 2025 21:37:38 +0000
Post From: Difference in result at different Replay speed
[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
|
![]() ![]() |