Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 07:14:19 +0000



Post From: sc.GetVolumeAtPriceDataForStudyProfile returns always 1

[2021-04-17 13:01:55]
Ernie Doo - Posts: 46
Dear SC team,

I am having some problems using sc.GetVolumeAtPriceDataForStudyProfile. This function should return 1 if succesful and 0 if not, right? Well it is always returning 1, also when it has reached the top of the profile and there is no more information available to fetch.

If I ran a "while (sc.GetVolumeAtPriceDataForStudyProfile(VOLUME_BY_PRICE_STUDY, 0, Index, VolumeAtPrice)) ++Index;", it should eventually exit the loop, right? It doesn't. It stays in an infinite loop. I debugged it a little bit further and found out that once the function reaches the top of the Volume By Profile study it just keeps repeating the last values (PriceInTicks, Volume, BidVolume, AskVolume, NumberOfTrades) of the last index.

With this last information I was able to just compare the prices from the current index vs the last index to exit the loop, which works, but I am not sure this function is working as intended.

I know I could have used sc.GetNumPriceLevelsForStudyProfile to limit my loop, but this function is also giving me some strange data. I am not saying it doesn't work, I just wanted to have another way of looping through this information.

Anyway, let me know if this is corrected so I can change my code back to normal, or if I am understanding it wrong and this is how it is supposed to work.

Regards,
Ernesto
Date Time Of Last Edit: 2021-04-17 15:51:49