Login Page - Create Account

Support Board


Date/Time: Sun, 02 Nov 2025 02:56:49 +0000



[Programming Help] - Custom study to display a study collection based on timeframe.

View Count: 173

[2025-09-25 15:30:12]
User246799 - Posts: 21
Hello, I have created a custom study that applies on a chart a study collection based on the selected bar period.

Example : I select the 1 minute bar period and then the study collection "A" is applied.
I change to the 5 minute bar period and then, the study collection "A" is replaced by the study collection "B".

But I have a problem !

The problem is that when a new study collection is applied after a bar period modification, the previous study collection is not deleted.
The new study collection is added to the previous one again and again --> Big mess !
I don't know how to solve this. Could you please help me ?
Thank you.

(You should have my custom study in attached files.)
attachmentStudyCollectionVsTimeframe.cpp - Attached On 2025-09-25 15:28:34 UTC - Size: 4.8 KB - 48 views
[2025-09-26 02:02:10]
ForgivingComputers.com - Posts: 1150
Are you unchecking the box "Prompt to Remove Existing Studies" when you save the study collections? I haven't tried it, and I don't know what would happen to your custom study. Let us know.

Brad
[2025-09-26 08:19:13]
User246799 - Posts: 21
Well, there is absolutely no difference whether I check or uncheck this box. It's always the same. The first study collection is loaded, then the second one is added to the first one... And the same study collection is also added each time I request the same timeframe.
I mean, every time I request the 1m timeframe for example, then the corresponding study collection is loaded again and again. So you have multiple overlaps of the same study collection...
[2025-09-26 09:28:29]
User431178 - Posts: 805
there is absolutely no difference whether I check or uncheck this box

The check box is not relevant in this case, that is for manually added study collections.

ACSIL Interface Members - Functions: sc.ApplyStudyCollection()

You would use the third argument if you wanted to remove the studies, but that doesn't work for you as it would also remove the Study Collection vs. Timeframe study.
If you want to remove all but the controlling study, you can do it from within the study by iterating over the list of studies on the chart and removing them all except that you wish to retain.
I made some edits to your code, it works as you want now I think.
Date Time Of Last Edit: 2025-09-26 09:29:17
attachmentStudyCollectionVsTimeframe.cpp - Attached On 2025-09-26 09:27:49 UTC - Size: 5.74 KB - 40 views
[2025-09-26 10:04:21]
User246799 - Posts: 21
Thank you very much for your help.
I tried the code as you sent but there is no difference. Do I have something to modify or add to make it work ?
[2025-09-26 10:22:15]
User431178 - Posts: 805

I tried the code as you sent but there is no difference.

Are you sure, it worked fine for me...
I uploaded the code that I tested directly.
Here is a video showing swap of volume profile study collection based on 1 min vs. 15 min.
Date Time Of Last Edit: 2025-09-26 10:22:45
attachmentstudy collections timeframe.mp4 - Attached On 2025-09-26 10:21:34 UTC - Size: 1.81 MB - 33 views
[2025-09-26 12:38:46]
User246799 - Posts: 21
Well, it din't work initially so I deleted my old .cpp and .dll files, I downloaded the current Sierra chart version (I had 2782) and rebuilt the study.
And now it works well !!

Thank you very much for your help ! That's cool to have this study now.
Thanks again, have a great day.

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

Login

Login Page - Create Account