Login Page - Create Account

Support Board


Date/Time: Tue, 07 Dec 2021 18:34:07 +0000



Post From: IsReplayRunning() incorrect on last bar

[2021-07-26 22:22:25]
User660727 - Posts: 24
The problems are 100% reproducible. Since you didn't share your code or complete log, I'm not sure what you tested but the attached code and output clearly show the following issues.

Problems:
1) Replay stops 2 bars before the last bar. I would expect replay to replay thru the last tick available

2) The last bar is sent w/o any replay flags (IsreplayRunning, GetReplayHasFinishedStatus), recalculation flag, or reset of index. This is truly an invalid state and looks to the code like real time data but is in fact replay data.

3) Per the current GetReplayHasFinishedStatus() documentation, I would expect to see a final callback of the last bar "one more time" with GetReplayHasFinishedStatus flag set to indicate that the replay has completed. If that's not the case, it would be great if you'd update the documentation to match the functionality. Currently the flag is set prior to the last bar.


This code run while disconnected with the attached replay settings:
#include <sierrachart.h>

SCDLLName("ReplayTest"); //DLL name

SCSFExport scsf_ReplayTest(SCStudyGraphRef sc) {
if (sc.SetDefaults) {
sc.AutoLoop = 0;
sc.AddMessageToLog("SetDefaults",0);
return;
}
if (sc.LastCallToFunction) { sc.AddMessageToLog("last call",0); return; }
SCString s;
s.Format("%s index:%d recalc:%d replay:%d finished:%d",
sc.DateTimeToString(sc.BaseDateTimeIn[sc.UpdateStartIndex],FLAG_DT_COMPLETE_DATETIME).GetChars()
,sc.UpdateStartIndex
,sc.IsFullRecalculation
,sc.IsReplayRunning()
,sc.GetReplayHasFinishedStatus()
);
sc.AddMessageToLog(s,0);
}

Produces this output:
Chart: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:05:00 index:8164 recalc:0 replay:0 finished:0 | 2021-07-26 16:32:01.552
Replay 200000X: ESU21 [C][M] 1 Min #1 | Reloading chart. | 2021-07-26 16:32:03.085
Replay 200000X: ESU21[M] 1 Min #3 | Reloading chart. | 2021-07-26 16:32:03.092
Replay 200000X: ESU21[M] 1 Trades #4 | Reloading chart. | 2021-07-26 16:32:03.111
Replay 200000X: ESU21 [C][M] 1 Sec #6 | Reloading chart. | 2021-07-26 16:32:03.119
Replay 200000X: ESU21 [C][M] 1 Sec #5 | Reloading chart. | 2021-07-26 16:32:03.127
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-18 17:00:00 index:0 recalc:1 replay:1 finished:0 | 2021-07-26 16:32:05.713
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 13:59:00 index:8158 recalc:0 replay:1 finished:0 | 2021-07-26 16:32:07.599
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:00:00 index:8159 recalc:0 replay:1 finished:0 | 2021-07-26 16:32:07.605
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:01:00 index:8160 recalc:0 replay:1 finished:0 | 2021-07-26 16:32:07.610
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:02:00 index:8161 recalc:0 replay:1 finished:0 | 2021-07-26 16:32:07.614
Chart: Replay 200000X: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:03:00 index:8162 recalc:0 replay:1 finished:0 | 2021-07-26 16:32:07.618
Replay 200000X: ESU21 [C][M] 1 Min #1 | Back test processing: NumberOfTimesCalculateCalled (Cumulative) = 0 | 2021-07-26 16:32:07.620
Chart: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:04:00 index:8163 recalc:0 replay:0 finished:1 | 2021-07-26 16:32:07.621
Replay 200000X: ESU21[M] 1 Min #3 | Back test processing: NumberOfTimesCalculateCalled (Cumulative) = 20 | 2021-07-26 16:32:07.622
Replay 200000X: ESU21[M] 1 Trades #4 | Back test processing: NumberOfTimesCalculateCalled (Cumulative) = 235 | 2021-07-26 16:32:07.629
Replay 200000X: ESU21 [C][M] 1 Sec #6 | Back test processing: NumberOfTimesCalculateCalled (Cumulative) = 32 | 2021-07-26 16:32:07.631
Replay 200000X: ESU21 [C][M] 1 Sec #5 | Back test processing: NumberOfTimesCalculateCalled (Cumulative) = 32 | 2021-07-26 16:32:07.632
Chart: ESU21 [C][M] 1 Min #1 | Study: Custom DLL Study | 2021-07-26 14:05:00 index:8164 recalc:0 replay:0 finished:0 | 2021-07-26 16:32:09.601

imagereplay-settings.png / V - Attached On 2021-07-26 22:19:32 UTC - Size: 22.54 KB - 55 views