Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 00:24:59 +0000



Post From: What happens when I click OK/Apply in Studies window?

[2023-10-14 05:35:31]
User907967 - Posts: 54
Hi all,

I struggled with this for months (I still am). I have the same problem as the users above.

Let's assume I have developed a study. To avoid concern about manual/auto-looping, here is the relevant default section:

sc.AutoLoop = true;

I've also added one of the generic studies: Current Price Line.

My study uses subgraphs and the s_UseTool. Without going into too much detail, I use the subgraphs to carry values from one period to another. I avoid taking any action for the first few periods. When I decide to do so, I use the values in the subgraphs to draw various shapes. For the avoidance of doubt about the changes I am reporting, those refer to subgraphs (not to the s_UseTool). I understand how Arrays work from the ASCIL perspective, or at least I have sufficient understanding to develop a study from sc.Index = 0 with 5+ subgraphs, all handling various calculations.

This is what I struggle to understand:
Example 1 - If I compile my study, remove and add it, then press Ok/Apply from the Studies window (F6), it loads with no problems.
Example 2 - Pressing Insert achieves the same result.

Example 3 - However, if I press Chart> Recalculate, the Chart renders slightly different results, and I struggle to understand why.
Example 4 - Equally, if I load the settings for the Current Price Line and then press Apply, I get the same (less desirable) results.

I get that a recalculation is involved in the second two examples, but it is not the same recalculation as if I acted in the first two examples.

I enforced the following code just after the end of the Defaults section of the study to see how it behaves:
Example 5
c.FlagFullRecalculate = true;

In this fifth example, I can see for a split second the study loads as I expect it to load, then immediately after, it starts to refresh consecutively, showing the outputs I am not expecting to see. This confirms that the 'refreshing' triggered in examples 3, 4 and 5 is slightly different than that in examples 1 and 2.

I wrote this post as explicitly and detailed as possible to show you my thought process. I kindly ask the Sierra Chart support/engineering team to help us understand what we are missing.

Temporary solution
Because I was unable to understand what was happening in this "full" recalculation (examples 3-5) that does not occur in a standard load (examples 1-2), as an interim solution, I decided to force my study to
exit
if it feels a full recalculation is underway. I don't think that's an excellent long-term solution. I want to learn to work with SierraCharts, but I can only patch my study this way until it's clear what's different between these two scenarios. On a few occasions, I also felt that it did not work (so if I had hit Apply on other studies, my study would still change in a way I can't tell what has gone wrong).

Here's the patch, written just under the Definitions:
if (sc.FlagFullRecalculate == true) { exit; }

Thank you.
Date Time Of Last Edit: 2023-10-14 05:45:03