Support Board
Date/Time: Sat, 01 Feb 2025 16:59:06 +0000
ACSIL control of chart bar period and days to load
View Count: 2856
[2018-07-12 18:20:39] |
dtl-saw - Posts: 79 |
Is there a way from ACSIL to control the number of days to load and the bar period of a chart? I've tried doing it with the code shown below using a custom button but nothing changes in the chart. None of the days to load or bar period parameters change in the chart. I know the button is working correctly from message logs. Also, I am currently using SC built in bar period buttons but want to add more functionality like number of days to load, etc. ACSIL study code snippet: n_ACSIL::s_BarPeriod NewBarPeriod; // assign current chart parameters sc.GetBarPeriodParameters(NewBarPeriod); // change the parameters i want to change NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_DAYS_MINS_SECS; NewBarPeriod.IntradayChartBarPeriodParameter1 = 1 * 60; // 1 minute * 60 sec/min // Set the new bar period parameters sc.SetBarPeriodParameters(NewBarPeriod); sc.DaysToLoadInChart = 10; |
[2018-07-16 19:19:37] |
Sierra Chart Engineering - Posts: 104368 |
This should work fine. We are testing this code.
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 |
[2018-07-21 23:37:38] |
dtl-saw - Posts: 79 |
Were you able to get these functions and this code to work on your system? If so, do you have any suggestions for how I can get it to work? |
[2018-07-22 00:09:09] |
Sierra Chart Engineering - Posts: 104368 |
This works: sc.DaysToLoadInChart = 10; There was a problem with this function: sc.SetBarPeriodParameters(NewBarPeriod) We solved that problem with that function. Use the latest prerelease for the corrections. 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: 2018-09-11 08:49:33
|
[2018-09-10 23:17:17] |
User476002 - Posts: 28 |
Is it possible to control the bar period from a spreadsheet study?
|
[2018-09-11 08:49:53] |
Sierra Chart Engineering - Posts: 104368 |
No, it is not. You need to use ACSIL to accomplish this.
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 |
[2019-07-16 17:39:32] |
User681685 - Posts: 12 |
Hi... I used the same code: .... sc.GetBarPeriodParameters(NewBarPeriod); NewBarPeriod.IntradayChartBarPeriodType = IBPT_RANGE_IN_TICKS_STANDARD; if (NewBarPeriod.IntradayChartBarPeriodParameter1 != r1) { NewBarPeriod.IntradayChartBarPeriodParameter1 = r1; sc.SetBarPeriodParameters(NewBarPeriod); } in Live it works fine, but not in Replay. Do you know wy? |
[2019-07-16 21:35:39] |
Sierra Chart Engineering - Posts: 104368 |
Increase the replay speed so there is some activity in the chart so the study function is called. Maybe that is the problem.
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 |
[2019-07-18 06:49:35] |
User681685 - Posts: 12 |
hi... this does not solve the problem. ist there a restriction regarding linking charts? here is my compleet code attached... |
VRRangedetector.cpp - Attached On 2019-07-18 06:49:05 UTC - Size: 17.7 KB - 308 views |
[2019-07-18 07:42:41] |
Sierra Chart Engineering - Posts: 104368 |
What we want you to do is to test this study function below. Build it and apply the study to an Intraday chart and do a replay. The chart bars will change to 5 minutes. During the replay change the chart bars to 1 minute per bar and then they should automatically change back to 5 minutes. SCSFExport scsf_BarPeriodParametersTest(SCStudyInterfaceRef sc)
{ if (sc.SetDefaults) { // Set the configuration and defaults. sc.GraphName = "Bar Period Parameters Test"; sc.AutoLoop = 0; sc.GraphRegion = 0; sc.UpdateAlways = 1; return; } n_ACSIL::s_BarPeriod BarPeriod; sc.GetBarPeriodParameters(BarPeriod); if (BarPeriod.ChartDataType == INTRADAY_DATA && BarPeriod.IntradayChartBarPeriodType == IBPT_DAYS_MINS_SECS) { int SecondsPerBar = BarPeriod.IntradayChartBarPeriodParameter1; } SCString DebugString; DebugString.Format ( "Bar Period type=%d, parameters={%d, %d, %d, %d}." , BarPeriod.IntradayChartBarPeriodType , BarPeriod.IntradayChartBarPeriodParameter1 , BarPeriod.IntradayChartBarPeriodParameter2 , BarPeriod.IntradayChartBarPeriodParameter3 , BarPeriod.IntradayChartBarPeriodParameter4 ); sc.AddMessageToLog(DebugString, 0); if (BarPeriod.ChartDataType != INTRADAY_DATA || BarPeriod.IntradayChartBarPeriodType != IBPT_DAYS_MINS_SECS || BarPeriod.IntradayChartBarPeriodParameter1 != 300) { n_ACSIL::s_BarPeriod NewBarPeriod; NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_DAYS_MINS_SECS; NewBarPeriod.IntradayChartBarPeriodParameter1 = 300;// 300 seconds per bar which is 5 minutes //Set the bar period parameters. This will go into effect after the study function returns. sc.SetBarPeriodParameters(NewBarPeriod); } } 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 |
[2019-07-18 09:52:53] |
User681685 - Posts: 12 |
hi... Thank yuo for the code. I Find the Problem now. but i dont know what is wrong. The Problem is in this case.... {.....} SCDateTime& pLastCalculationDateTime = sc.GetPersistentSCDateTime(50); SCDateTime& pLastRangeChangeDateTime = sc.GetPersistentSCDateTime(51); if (CurrentDateTime - pLastRangeChangeDateTime > (Input_ChTime.GetInt() * SECONDS)) { ..... //calculation and Range-Change.... } pLastCalculationDateTime = CurrentDateTime; {.....} ------------------- when i make the Time-questions extract from code, then it works on replay to, with... only in realtime... can you help me? |
[2019-07-18 09:55:07] |
User681685 - Posts: 12 |
... sorry vorgot the Global Var on the top SCDateTimeMS CurrentDateTime = sc.GetCurrentDateTime(); |
[2019-07-18 10:52:35] |
User681685 - Posts: 12 |
... I see the pLastRangeChangeDateTime contains the Last Time from Real.... in Replay to.... is ther a way to reset it only on entry in Replay mode? |
[2019-07-19 04:03:40] |
Sierra Chart Engineering - Posts: 104368 |
We are not understanding this and we do not provide programming help. You need to understand that you know your code best. We cannot get involved with your own code. Here is the documentation for sc.GetCurrentDateTime sc.GetCurrentDateTime() 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: 2019-07-19 04:04:11
|
[2019-07-28 16:54:45] |
User681685 - Posts: 12 |
hi... i find it.... if (sc.IsReplayRunning()) CurrentDateTime = sc.CurrentDateTimeForReplay; else CurrentDateTime = sc.CurrentSystemDateTime; Thanks. its solved... |
To post a message in this thread, you need to log in with your Sierra Chart account: