Custom Study Execution Bug?

Nudge

Member
Joined
May 22, 2019
Posts
17
Likes
6
Hi,

When I add a custom study and set visibility to only show on one chart time frame, it appears to execute for all open charts irrespective on the visibility set. Is there a way to prevent execution of the code for time frames its not visible on?

If this is not a bug, then I can see a couple issues that will cause problems with this type of logic. Writing to local files, querying online API/Databases.

Tested by writing debug info to the Study Log.

Running Mac Beta Version
 

dsinnig

Active member
Joined
Jun 14, 2019
Posts
25
Likes
18
Hi Nudge,

I believe you are correct. The visibility setting is really just about displaying / hiding the study plots and not about performing / not performing the actual calculations. By looking through the API documentation, I did not find a method to determine on which timeframe / chart type the study should be visible.

I guess an easy workaround would be to add a custom study parameter for the "calculation timeframe". Then in the calculate method you could check if the chart timeframe matches the calculation timeframe and execute or skip the calculation accordingly.

As for the concurrency issues you mentioned, I ran some tests and it looks like the calculations for each timeframe are done by the same thread sequentially thus there should not be any concurrency issue.

Hope this helps.
 

Nudge

Member
Joined
May 22, 2019
Posts
17
Likes
6
Hi Dsinnig,

Thanks for taking the time to look into this and confirm and offer a workaround. Hope to return the favor one day.

Cheers
 
Top