Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 02:25:12 +0000



[Programming Help] - sc.UpdateStartIndex == 0 condition when running a autotrade system replay backtest

View Count: 1304

[2016-02-27 17:38:23]
@sstfrederik - Posts: 404
When I start a replay backtest the condition sc.UpdateStartIndex == 0 is seen many times. The study is in manual loop. I would not expect that. I intend to do a few things only once when the study is loaded and sc.UpdateStartIndex == 0 When doing a backtest this does not seem to work and this part of my code gets called way to much to be efficient.

Any suggestions?

Thanks.

#include "sierrachart.h"

SCDLLName("Test DLL")

SCSFExport scsf_Test(SCStudyInterfaceRef sc)
{
  
  
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    
    sc.GraphName = "Test Study";
    
    sc.StudyDescription = "This is a test study function";
    
    sc.AutoLoop = 0;
    
    // During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance.
    sc.FreeDLL = 1;
    
    return;
  }
  
  
    
  // Do data processing
  if (sc.UpdateStartIndex == 0) {
    sc.AddMessageToLog("UpdateStartIndex = 0", 1);
  }
  
  
  if (sc.Index == 0)
  {
    
    sc.AddMessageToLog("Index = 0", 1);
  }
  
}

[2016-02-27 18:03:35]
Sierra Chart Engineering - Posts: 104368
It does occur only once. There must be a misunderstanding.

Maybe you have multiple instances of the study on one or more charts. Or possibly the chart containing the study makes references to other charts which are triggering a full recalculation. You can see this through the Message Log:

https://www.sierrachart.com/index.php?page=doc/doc_ChartStudies.html#ReferencesOtherChartsTagging
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: 2016-02-27 18:04:16
[2016-02-27 18:27:46]
@sstfrederik - Posts: 404
I have only one chart open and only use the study of which I posted the code. When I load the study it occurs only once. When I conduct a replay backtest my message log fills with the messages as stated in the code. This happens after the first few bars have started to replay and only once (one burst of messages).

With the bar backtest this also occurs but less often.

I am running 1371.
I can send the message-log if that is useful.
Date Time Of Last Edit: 2016-02-27 18:28:45
[2016-02-27 19:16:00]
Sierra Chart Engineering - Posts: 104368
As expected we only got one of them on starting a replay:
Chart: Replay 30.0X: ESH16 [M] 1 Min #1 | Study: Test Function 3 | UpdateStartIndex = 0 | 2016-02-27 20:15:09 *

Also, there is no chance that there could be the condition you are describing solely because of starting a replay.


Therefore, your study function is getting recalculated for other reasons. Not because of the replay.

We gave you a reason as to possibly why.
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: 2016-02-27 19:16:59
[2016-02-27 20:20:42]
@sstfrederik - Posts: 404
I understand that this should not happen, but it is happening. I have been debugging this for a while and it can not be more bare bones than it currently is. Starting with a new install of SC, DTS is "SC Data-All Services", build study, load the ES intraday chart as the only open chart, load the study, disconnect DTS and run a backtest. I still have the same issue. See my message log output below.
When I do a bar based backtest it also happens but only 5 times. What is left to debug?

Chart: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:50 *
Replay 1.0X: ESH16 60 Min #1 | Reloading chart. | 2016-02-27 15:04:55
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
Chart: Replay 1.0X: ESH16 60 Min #1 | Study: Test Study | UpdateStartIndex = 0 | 2016-02-27 15:04:55 *
[2016-02-27 20:37:28]
Sierra Chart Engineering - Posts: 104368
How many bars in the chart?

Describe the specific steps to run the back test.
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
[2016-02-27 20:52:17]
@sstfrederik - Posts: 404
I run the backtest on 10 days of data and 60min bars. The bar based backtest is run on 250 bars and the test study provides 5 times output of startindex being 0.
When doing a replay backtest this is way more over 600 times. This only happens at the beginning of the backtest, all notifications in the messagelog have the same timestamp.
Backtest is run from the Trade menu --> Autotrade system bar based backest and Trade-->Autotrade Replay Backtest.
[2016-02-28 00:46:35]
Sierra Chart Engineering - Posts: 104368
This is occurring because at the start of the back test, the first and only bar in the chart is being updated many times.

We had not thought of that scenario. When we said this could not happen was based upon there being more than one bar in the chart which is the usual case.

For initialization you need to use:
sc.IsFullRecalculation

However, it does not handle this scenario and we need to make some changes to support this. This will be out in the next release.
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: 2016-02-28 00:47:47
[2016-02-28 02:01:14]
@sstfrederik - Posts: 404
Thanks. Would appreciate it if you could tell me how to implement this when the changes are made.
[2016-02-29 18:21:21]
Sierra Chart Engineering - Posts: 104368
The documentation for this has been updated here:
https://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html#scIsFullRecalculation
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
[2016-03-06 19:25:57]
@sstfrederik - Posts: 404
Any news when changes for this issue will be implemented. Thanks.
[2016-03-06 20:18:15]
Sierra Chart Engineering - Posts: 104368
This was released more than a week ago.

The change is definitely part of 1376.
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
[2016-03-06 20:35:22]
@sstfrederik - Posts: 404
The code above still produces the same issue. many instances of sc.UpdateStartIndex being 0
[2016-03-06 20:45:18]
Sierra Chart Engineering - Posts: 104368
We are testing this now.
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
[2016-03-06 20:54:22]
@sstfrederik - Posts: 404
For context on why this is important for me. I load an external file when index = 0 and want to prevent the url to be called to often.
Date Time Of Last Edit: 2016-03-06 20:54:42
[2016-03-06 21:52:10]
Sierra Chart Engineering - Posts: 104368
What you say in post #13 is true and it is an impossibility for that to change. But what we indicated before is that you must now use this:

https://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html#scIsFullRecalculation
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
[2016-03-06 22:09:54]
@sstfrederik - Posts: 404
I see that IsFullRecalculation is the new sc.index == 0 for initialization. thanks.

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

Login

Login Page - Create Account