Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 10:58:03 +0000



IsReplayRunning() incorrect on last bar

View Count: 656

[2021-06-30 17:42:23]
User660727 - Posts: 50
Summary: IsReplayRunning() returns false on the last bar of a replay. I would expect a value of true.

Connection Status: Disconnected
Manual Replay settings:
Mode: Accurate
Use Start Date-Time: true
Speed: 200000
Skip Empty Periods: true

Problem: I need a reliable way to determine that I am backtesting. Is there is another method/property to determine this?
[2021-07-05 08:47:53]
Sierra Chart Engineering - Posts: 104368
The value of that variable must be accurate. So what you must be seeing, is the replay has ended when it is false.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-07 16:52:11]
User660727 - Posts: 50
Below is a log showing all study calls during a replay from 7/7/21 10:55
The last tick of available data is at 10:59:14
The study is set for manual looping
The chart is configured for 1 minute bars
Sierra Chart is disconnected
Attached are the replay settings and the last tick of data for the symbol

As you can see:
IsReplayRunning is turned off starting at 10:58. Shouldn't this be set thru the last bar at 10:59?
GetReplayHasFinishedStatus is set at 10:58. Shouldn't this be set at the 10:59 bar?
The last bar of the replay (10:59) is called twice but with both flags cleared. Why is the last bar not included in the replay?


IsReplayRunning:0 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,494 2021-07-7 10:59:00
IsReplayRunning:0 GetReplayHasFinishedStatus:0 UpdateStartIndex:0 2021-06-27 17:00:00
IsReplayRunning:0 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,494 2021-07-7 10:59:00
IsReplayRunning:1 GetReplayHasFinishedStatus:0 UpdateStartIndex:0 2021-06-27 17:00:00
IsReplayRunning:1 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,490 2021-07-7 10:55:00
IsReplayRunning:1 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,491 2021-07-7 10:56:00
IsReplayRunning:1 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,492 2021-07-7 10:57:00
IsReplayRunning:0 GetReplayHasFinishedStatus:1 UpdateStartIndex:10,493 2021-07-7 10:58:00
IsReplayRunning:0 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,494 2021-07-7 10:59:00
IsReplayRunning:0 GetReplayHasFinishedStatus:0 UpdateStartIndex:10,494 2021-07-7 10:59:00


imagereplay.png / V - Attached On 2021-07-07 16:45:01 UTC - Size: 24.89 KB - 180 views
imagelast tick.png / V - Attached On 2021-07-07 16:45:10 UTC - Size: 26.24 KB - 172 views
[2021-07-08 08:49:13]
Sierra_Chart Engineering - Posts: 14006
We have to look this over, but it depends actually upon when the study function is called in relation to the data read from the Intraday data file.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-12 23:44:17]
User660727 - Posts: 50
Any update on this? If this is not a bug, please explain why not. If it is, please acknowledge.

Disappointing that you don't have a process to close tickets and are willing to simply leave them unresolved
[2021-07-22 09:20:14]
Sierra_Chart Engineering - Posts: 14006
We have not had time to get to this yet. We expect to do it this week.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-23 09:13:24]
Sierra Chart Engineering - Posts: 104368
The problem is not reproducible at all. It is fairly involved to go through these tests, and this is why it was set aside until we had a chance.

These tests were done with Accurate Trading System Back test Mode:

Replaying Charts: Replay Mode

This is with automatic looping:
Chart: NQU21-CME[M] 10 Min #1 | Study: Test Function 2 | FinishedStatus. Index=212. ArraySize=213 | 2021-07-23 05:12:51.234


This is with manual looping:
Chart: NQU21-CME[M] 10 Min #1 | Study: Test Function 7 | FinishedStatus. Index=202. ArraySize=203 | 2021-07-23 03:30:30.977


These messages occur just once at the end of the replay. And also understand the indexes are zero-based and will always have a value 1 less compared to the array size but they occur on the final bar.

  int FinishedStatus = sc.GetReplayHasFinishedStatus();

  if (FinishedStatus)
  {
    SCString Message;
    Message.Format("FinishedStatus. Index=%d. ArraySize=%d", sc.Index, sc.ArraySize);
    sc.AddMessageToLog(Message, 0);
  }

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2021-07-23 09:14:19
[2021-07-26 22:22:25]
User660727 - Posts: 50
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 - 167 views
[2021-08-04 00:29:46]
Sierra Chart Engineering - Posts: 104368
We still have not had a chance to look at this, but one thing we want to know is this a multi-chart back test using a Processing Step in Seconds?

The behavior might be different in that case. That has not been considered as to how sc.GetReplayHasFinishedStatus() would work in that case.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-08-04 11:55:28]
User660727 - Posts: 50
Yes, step = 1

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account