Login Page - Create Account

Support Board


Date/Time: Sat, 21 Sep 2024 00:54:34 +0000



[Programming Help] - changing an opened chart parameters

View Count: 632

[2018-11-06 04:19:14]
__deuss - Posts: 3
Hi Sierra team is it possible to change an opened chart parameters for example if i have two chart that are opened like this

for (int i = 1; i <= 2; i++) {
ChartsMap = Chartss{};
ChartsMap.Resolution = 30000/i;

s_ACSOpenChartParameters OpenChartParameters;
//OpenChartParameters.PriorChartNumber = ChartNumber;
OpenChartParameters.ChartDataType = INTRADAY_DATA; //This can also be set to: DAILY_DATA
OpenChartParameters.Symbol = sc.GetRealTimeSymbol();// sc.Symbol('ESU8')//When want to use the symbol of the chart the study function is on, use sc.GetRealTimeSymbol()
OpenChartParameters.IntradayBarPeriodType = IBPT_VOLUME_PER_BAR;
OpenChartParameters.IntradayBarPeriodLength = ChartsMap[Rsltn].Resolution;
OpenChartParameters.LoadWeekendData = 1;

ChartsMap.ChartNumber = sc.OpenChartOrGetChartReference(OpenChartParameters);
sc.SetChartWindowState(ChartsMap.ChartNumber, CWS_RESTORE);
}

how can i modify both chart number 2 and 3 down the road let say there is a condition based on which at each trading day start i have to reset the chart parameters base on the volume of the previous day.

i just need a function to modify the opened chart volume.

i already tried to close all the previous chart like this and open a new charts with new parameters but that is not working correctly

if (Reset == true)
{
firstRun = true;
startIndex = Index;
}
int CurrentBarTime = sc.BaseDateTimeIn[Index].GetTime();
if (firstRun && (CurrentBarTime >= 34200 && CurrentBarTime < 57600)){
float tmpVolume = (0.05f)*(Index - startIndex)*15000;
int i = 2;
while(i >= 1){
if (sc.IsChartNumberExist(ChartsMap.ChartNumber, ""))
{
sc.CloseChart(ChartsMap.ChartNumber);
}
ChartsMap.Resolution = (int)(tmpVolume / i);
i--;
}
Message.Format("first Resolution: %d, first id: %d, Second Resolution: %d, Second id: %d, currentIndex: %d, startIndex: %d", ChartsMap[1].Resolution, ChartsMap[1].ChartNumber, ChartsMap[2].Resolution, ChartsMap[2].ChartNumber, Index, startIndex);
sc.AddMessageToLog(Message, 0);
firstRun = false;
}

can you please advise?

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

Login

Login Page - Create Account