Login Page - Create Account

Support Board


Date/Time: Fri, 21 Feb 2025 09:47:46 +0000



[Programming Help] - Historical Data for sc.GetBasicSymbolData

View Count: 79

[2025-02-19 19:03:38]
User763002 - Posts: 30
Hi Support,

Is there a way to pull historical data for symbols that are being used with the sc.GetBasicSymbolData function?

Thanks
[2025-02-19 21:39:12]
cmet - Posts: 639
Probably take a few steps.

What exactly are you trying to do?
[2025-02-20 01:43:07]
Sierra_Chart Engineering - Posts: 18503
No this is not supported. You will need a separate chart for those symbols and reference them:
Referencing Other Time Frames and Symbols When Using the ACSIL
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
Date Time Of Last Edit: 2025-02-20 01:43:40
[2025-02-20 02:16:13]
User763002 - Posts: 30
Thank you Engineering, is this something I can put in as a feature request?

Cmet, I am attempting to make a custom index using some of the equities, but the weights of the index change fairly frequently so I am trying to avoid using the built-in custom symbol functionality.
[2025-02-20 03:34:53]
cmet - Posts: 639
Well, there you go.

Not too difficult to pull data from separate charts and plot the index.

Can manually adjust weights with inputs or, if you have a dynamic way to calc those, you can add an auto update functionality.

Quick example if you need it. Add as many symbols/weights as you want as long as it has an open chart.

#include "sierrachart.h"

SCDLLName("WeightedIndexStudy")

SCSFExport scsf_WeightedIndex(SCStudyInterfaceRef sc)
{
SCSubgraphRef IndexValue = sc.Subgraph[0];

SCInputRef Chart1 = sc.Input[0];
SCInputRef Chart2 = sc.Input[1];
SCInputRef Chart3 = sc.Input[2];

SCInputRef Weight1 = sc.Input[3];
SCInputRef Weight2 = sc.Input[4];
SCInputRef Weight3 = sc.Input[5];

if (sc.SetDefaults)
{
sc.GraphName = "Weighted Index";
sc.AutoLoop = 1;

IndexValue.Name = "Index Value";
IndexValue.DrawStyle = DRAWSTYLE_LINE;
IndexValue.PrimaryColor = RGB(0, 255, 0);
IndexValue.LineWidth = 2;

Chart1.Name = "Chart Number 1"; Chart1.SetChartNumber(1);
Chart2.Name = "Chart Number 2"; Chart2.SetChartNumber(2);
Chart3.Name = "Chart Number 3"; Chart3.SetChartNumber(3);

Weight1.Name = "Weight 1"; Weight1.SetFloat(0.5f);
Weight2.Name = "Weight 2"; Weight2.SetFloat(0.3f);
Weight3.Name = "Weight 3"; Weight3.SetFloat(0.2f);

return;
}

SCFloatArray Stock1, Stock2, Stock3;
sc.GetChartArray(Chart1.GetChartNumber(), SC_LAST, Stock1);
sc.GetChartArray(Chart2.GetChartNumber(), SC_LAST, Stock2);
sc.GetChartArray(Chart3.GetChartNumber(), SC_LAST, Stock3);

if (Stock1.GetArraySize() > sc.Index && Stock2.GetArraySize() > sc.Index && Stock3.GetArraySize() > sc.Index)
{
IndexValue[sc.Index] = (Stock1[sc.Index] * Weight1.GetFloat()) +
(Stock2[sc.Index] * Weight2.GetFloat()) +
(Stock3[sc.Index] * Weight3.GetFloat());
}
}

Date Time Of Last Edit: 2025-02-20 04:04:18
[2025-02-20 13:52:00]
User763002 - Posts: 30
Thanks Cmet, much appreciated

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

Login

Login Page - Create Account