Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 22:16:46 +0000



sc.SetChartStudyInputInt() reverts when used with sc.LastCallToFunction()

View Count: 500

[2023-09-09 20:06:48]
LudaTrades - Posts: 27
I have a custom study that modifies the numbers bars text type and volume multiplier based on visible bar count using sc.SetChartStudyInputInt(). When the script is first loaded I save the original values to be reset if the study is removed.

For some reason, resetting at sc.LastCallToFunction() is not possible; the values set for a split second then revert. I have logged everything and according to my log they set correctly.

I have tried sc.RecalculateChart(sc.ChartNumber) as the documentation suggests but I still run into this issue. I have reviewed the calculation precedence documentation and tried changing the study order and every sc.CalculationPrecedence with no luck either.

At this point I have come to the conclusion that there is something going on internally with Sierra Chart that is causing this, any help is greatly appreciated!
Private File
[2023-09-10 19:05:49]
Sierra_Chart Engineering - Posts: 17185
Yes this is logical:
At this point I have come to the conclusion that there is something going on internally with Sierra Chart that is causing this
We would have to look at why. But we want to know, what you are doing with the Chart or Chartbook which causes this to be true:
sc.LastCallToFunction
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-09-10 19:06:03
[2023-09-11 03:23:35]
LudaTrades - Posts: 27
We would have to look at why. But we want to know, what you are doing with the Chart or Chartbook which causes this to be true:
sc.LastCallToFunction

I'm removing the custom study and clicking Ok which triggers sc.LastCallToFunction
[2023-10-06 17:14:13]
LudaTrades - Posts: 27
Update to this issue:

I've discovered that the custom study behaves as expected when using the right click menu on the chart header, but when using the studies settings menu it does not.

When removing the custom study by right clicking the chart header, the cleanup process applies the inputs and they stay.
When removing the custom study from the study settings menu and clicking Ok, the inputs are applied for a moment and then revert.
When closing the chartbook and saving, the cleanup process does not apply the inputs either.

Attached an image for clarity
Date Time Of Last Edit: 2023-10-06 17:34:28
imageStudy_Removal_Types.png / V - Attached On 2023-10-06 16:58:57 UTC - Size: 64.95 KB - 99 views
[2023-10-11 07:23:56]
Sierra_Chart Engineering - Posts: 17185
We will check this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-10-19 01:32:14]
Sierra_Chart Engineering - Posts: 17185
It is not possible to change study Inputs for another study during the last call to a study function (sc.LastCallToFunction) when removing the study from Chart Studies window. The internal reason this is not possible is because in the Chart Studies window interface there is a temporary copy of the of the studies and their current state, although not including the subgraph arrays. When studies are removed through this interface they are making changes to the studies on the chart. After the studies are removed, then the remaining studies in the Chart Studies window are then applied to the chart reverting any changes to Inputs. This will not change.

In regards to the issue where the study input changes made during sc.LastCallToFunction are not saving to the Chartbook, we know the reason why that happens. The problem is a Chartbook has already been saved, before the sc.LastCallToFunction related call to the studies. We will change the timing to resolve this assuming there are no problems.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-10-20 14:57:34]
Sierra_Chart Engineering - Posts: 17185
This actually is not easily changed:

In regards to the issue where the study input changes made during sc.LastCallToFunction are not saving to the Chartbook, we know the reason why that happens. The problem is a Chartbook has already been saved, before the sc.LastCallToFunction related call to the studies. We will change the timing to resolve this assuming there are no problems.

It has only been changed to some extent. Only when closing a single Chartbook, with the Close Chartbook command.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-10-20 14:57:56
[2023-10-22 21:03:03]
LudaTrades - Posts: 27
I appreciate you taking the time to look into this. The main thing I want to accomplish is to go in and turn the dials of a study, but be able to put them back when I leave. I don't want a user to accidently lose a study configuration they have put time into. I have another custom study that changes volume by price settings dynamically that shares this problem.

Perhaps there is another solution to this that I'm not seeing?

Currently I am saving the original settings when the study is first loaded, and then I'm setting it to initialized. The problem comes when the settings are modified and the user closes the chartbook with them still modified. If I'm not able to revert them before the chartbook is closed, when they next load the chartbook the study is still edited, and it gets initialized in the edited state. Likewise for when they remove the study through the studies window.

The best I have currently come up with is instructions for the user: Backup chartbooks before loading my studies just in case, and set the study to hidden before removing it or closing the chartbook. This way I'm able to code in the reset on detecting if the study is hidden. It's not very elegant but I don't see an alternative.
[2023-10-22 22:46:49]
Sierra_Chart Engineering - Posts: 17185
Change the study inputs back to the original values when this is true:
sc.IsChartbookBeingSaved

But do not perform a recalculation. And then when this is no longer true, change the inputs back again.

The study which which is checking this variable needs to be set to sc.UpdateAlways to know when the Chartbook saving is complete.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-10-22 22:47:29

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

Login

Login Page - Create Account