Support Board
Date/Time: Mon, 24 Feb 2025 15:04:57 +0000
[User Discussion] - Accessing Cumulative Volume at Peak/Valley in a VbP Study
View Count: 580
[2021-03-09 17:58:03] |
User99735 - Posts: 234 |
Hi, Wanted to access the Cumulative Volume at the Peak/Valley lines displayed on the RHS ( highlighted in enclosed screenshot ). Combination of functions - sc.GetStudyPeakValleyLine(chartID, studyID, price, peakValleyType, startIndex, peakValleyExtensionChartColumnEndIndex, profileIndex, peakValleyIndex); sc.GetVolumeAtPriceDataForStudyProfile(studyID, profileIndex, peakValleyIndex, volumeAtPriceV2); is not working as the functions are returning values for only one profileIndex. Any other setting to be changed, please advise? Regards Vivek |
Attachment Deleted. ![]() |
[2021-03-11 22:35:07] |
User99735 - Posts: 234 |
Anybody??
|
[2021-03-11 22:39:09] |
User99735 - Posts: 234 |
This is the code used. Returns volume which does not match with what is displayed on chart. int GetVolumeAtPriceForProfile(SCStudyGraphRef sc, int chartID, int studyID, float inPrice, unsigned int& volAtPrice) { float price; int peakValleyType = 0; int startIndex = 0; int peakValleyExtensionChartColumnEndIndex = 0; int profileIndex = 0; int peakValleyIndex = 0; int result = 1; int resultVol = 1; int error = 0; s_VolumeAtPriceV2 volumeAtPriceV2; volAtPrice = 0; while (result) { if (sc.GetNumPriceLevelsForStudyProfile(studyID, profileIndex) == 0) { profileIndex++; if (profileIndex > startIndex) break; continue; } price = 0; result = sc.GetStudyPeakValleyLine(chartID, studyID, price, peakValleyType, startIndex, peakValleyExtensionChartColumnEndIndex, profileIndex, peakValleyIndex); if (!result) break; if (result && (price == inPrice)) { resultVol = sc.GetVolumeAtPriceDataForStudyProfile(studyID, profileIndex, peakValleyIndex, volumeAtPriceV2); sc.AddMessageToLog(SCString().Format("Volume %i, Profile Index %i, startIndex %i, peakValleyExtensionChartColumnEndIndex %i, peakValleyIndex %i, Price Level Count %i, price %f, inPrice %f", volumeAtPriceV2.Volume, profileIndex, startIndex, peakValleyExtensionChartColumnEndIndex, peakValleyIndex, sc.GetNumPriceLevelsForStudyProfile(studyID, profileIndex), price, inPrice), 0); profileIndex++; peakValleyIndex = -1; if (resultVol) { error = 1; volAtPrice += volumeAtPriceV2.Volume; } //else // return error; //continue; } peakValleyIndex++; } return error; } |
To post a message in this thread, you need to log in with your Sierra Chart account: