Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 21:37:21 +0000



Custom study - don't execute when chart is recalculating, reloading, anything, ...

View Count: 727

[2017-04-02 11:42:09]
User612903 - Posts: 51
Hi,

I've got a custom sutdy that works great, but sometime it get's called when I change some chart settings and the chart reload / recalculate.

This is what i have in my code, is there any other line I can use to stop it for running when it's not live.


if (!(sc.ServerConnectionState == SCS_CONNECTED)) {
    sc.AddMessageToLog("NOT CONNECTED", 1);
    return false;
  }
  if (sc.Index == 0) {
    sc.AddMessageToLog("INDEX == 0 ", 1);
    return false;
  }

  if (sc.IsFullRecalculation)//This indicates a study is being recalculated.
  {
    sc.AddMessageToLog("IsFullRecalculation", 1);
    return false;
  }



Thank you very much for your help.
[2017-04-02 19:18:46]
Sierra Chart Engineering - Posts: 104368
This is all you need to do.

What you have should cover all possibilities.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-04-03 21:35:37]
User612903 - Posts: 51
Okay, unfortunately in my case it's not enough.

For example this is what happened to me last week-end :
- on a chart which does not tick on the week-end, I changed some chart settings
- then i pressed insert to reload and recalculate

And my study got executed.

Anything i missed ?
[2017-04-04 00:16:49]
Sierra Chart Engineering - Posts: 104368
This can still happen. It can happen because after the full calculation there can still be an update calculation which is done.

You may want to add some code which checks the current time and returns if the market is not open based on the current time. You can use sc.CurrentSystemDateTime
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account