Support Board
Date/Time: Wed, 22 Jan 2025 00:01:46 +0000
new version doesn't support setting sc.VolumePerBar
View Count: 756
[2018-08-19 12:59:37] |
User44804 - Posts: 7 |
Hi, i have been using the sc.VolumePerBar extensively to set the Volume per bar according to the Volume of another time based chart. However i just discovered to my dismay that this function is no longer supported in the new software update. Now i have been trying to use sc.SetBarPeriodParameters instead, but it's not working. It's not even working when i'm just using a constant number for test purposes. What am i doing wrong here? Here's a snippet from the code: n_ACSIL::s_BarPeriod NewBarPeriod; sc.GetBarPeriodParameters(NewBarPeriod); NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_VOLUME_PER_BAR; NewBarPeriod.IntradayChartBarPeriodParameter1 = 1200; sc.SetBarPeriodParameters(NewBarPeriod); Thank you in advance. |
[2018-08-19 20:57:55] |
Sierra Chart Engineering - Posts: 104368 |
n_ACSIL::s_BarPeriod NewBarPeriod; //This is not really needed. It is okay to have though. //It should be used just to see if you even need to change the settings in case they are already as they need to be. sc.GetBarPeriodParameters(NewBarPeriod); NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_VOLUME_PER_BAR; NewBarPeriod.IntradayChartBarPeriodParameter1 = 1200; sc.SetBarPeriodParameters(NewBarPeriod); Make sure you are testing on the current version which is currently 1785. You can also use the prerelease. 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-08-19 21:00:14
|
[2018-08-25 08:28:23] |
User44804 - Posts: 7 |
Thank you for your reply. I am using version 1785. However, when i am using this function the chart gets into an endless loop always reloading the whole chart and never stopping. How can this be? In the older version there was no problem using sc.VolumePerBar. Here is the code : sc.DataStartIndex =sc.ArraySize-3; if((sc.ArraySize-2)<sc.Index) return; else { SCGraphData StudyData; sc.GetStudyArraysFromChartUsingID(Chartnumber.GetChartNumber(), Chartnumber.GetStudyID(), StudyData); // Define a reference to the first Subgraph array SCFloatArrayRef SubgraphArray = StudyData[0]; int RefChartIndex = SubgraphArray.GetArraySize()-2; float NearestSubgraphValue = SubgraphArray[RefChartIndex]; VolumeStudy[sc.Index]=SubgraphArray[RefChartIndex-1]/Divisor.GetInt(); int a = (int) VolumeStudy[sc.Index]; n_ACSIL::s_BarPeriod NewBarPeriod; sc.GetBarPeriodParameters(NewBarPeriod); NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_VOLUME_PER_BAR; NewBarPeriod.IntradayChartBarPeriodParameter1 = a; sc.SetBarPeriodParameters(NewBarPeriod); } As already mentionend, it doesn't matter whether i use the variable a as NewBarPeriod.IntradayBarPeriodParameter1 or simply put in a constant number 1200. The chart gets reloaded endlessly. |
[2018-08-25 09:46:27] |
Sierra Chart Engineering - Posts: 104368 |
Yes the continuous reloading does make sense. You need to prevent that by checking for the correct volume value and if it is as you require, then do nothing. This is why we added this comment: //It should be used just to see if you even need to change the settings in case they are already as they need to be. 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-08-25 10:11:23] |
User44804 - Posts: 7 |
Thank you for the quick reply. I have added an if-loop and now it's working. Here is the code in case somebody else wants to create such a function: sc.DataStartIndex =sc.ArraySize-3; if((sc.ArraySize-2)<sc.Index) return; else { SCGraphData StudyData; sc.GetStudyArraysFromChartUsingID(Chartnumber.GetChartNumber(), Chartnumber.GetStudyID(), StudyData); // Define a reference to the first Subgraph array SCFloatArrayRef SubgraphArray = StudyData[0]; int RefChartIndex = SubgraphArray.GetArraySize()-2; float NearestSubgraphValue = SubgraphArray[RefChartIndex]; VolumeStudy[sc.Index]=SubgraphArray[RefChartIndex-1]/Divisor.GetInt(); int a = (int) VolumeStudy[sc.Index]; n_ACSIL::s_BarPeriod NewBarPeriod; sc.GetBarPeriodParameters(NewBarPeriod); NewBarPeriod.ChartDataType = INTRADAY_DATA; NewBarPeriod.IntradayChartBarPeriodType = IBPT_VOLUME_PER_BAR; NewBarPeriod.IntradayChartBarPeriodParameter1 = a; if((sc.VolumePerBar < 0.95*a) || (sc.VolumePerBar > 1.05*a) ) { sc.SetBarPeriodParameters(NewBarPeriod); } } Kind regards |
To post a message in this thread, you need to log in with your Sierra Chart account: