Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 09:07:23 +0000



[Programming Help] - Study Function Programming Error Causing Freeze

View Count: 1069

[2019-01-10 06:46:54]
User345961 - Posts: 2
Hi,
as the title, It happens in Custom Study, Template Function, when I write a simple "cicle for" to find the first high bar, higher than actual.


SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    ......
    return;
  }
  
  
  // Section 2 - Do data processing here
unsigned int indexHigh;

  for(int i=sc.Index-1; ; i--)
  {
    if(sc.High > sc.High[sc.Index])
    {
      indexHigh = i;
      break;
    }
  }


Maybe it runs continuosly and could be the reason for the freeze....is there a way to insert a "delay" or "pause" in the code (like sleep function in python for example)
Or is it another problem?

Thank you!

[2019-01-10 08:43:51]
Sierra Chart Engineering - Posts: 104368
Yes that looks like an endless loop condition. You really need to study programming because that is completely wrong the way that for loop is written. Refer to:
https://www.cprogramming.com/tutorial/lesson3.html
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