Login Page - Create Account

Support Board


Date/Time: Sat, 28 Dec 2024 09:11:45 +0000



Unexepected values in GetPersistent when using sc.MaintainVolumeAtPriceData

View Count: 1065

[2016-03-30 08:23:45]
gomifromparis - Posts: 244
Hi,

I'm encountering a case where GetPersistentInt doesn't give the expected value.
To test, I use a static counter, and increment PersistentInt(0) on each call of sc.Index ==0.

To encounter the problem, all the following must be true :
* the study must use sc.MaintainVolumeAtPriceData = 1
* it must be the first study of the chart using the VAPContainer(sc.MaintainVolumeAtPriceData =1)
* on instantiation, the user must click Apply, then OK

If all the above are true, here's what happens

Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Begin Proc | 2016-03-30 10:16:24 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Current persistent : 0 | 2016-03-30 10:16:24 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Persistent is now : 1 | 2016-03-30 10:16:24 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | End Proc | 2016-03-30 10:16:24 *
CL-201605-NYMEX 5 Min #1 | Reloading chart. | 2016-03-30 10:16:24
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Begin Proc | 2016-03-30 10:16:25 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Current persistent : 1 | 2016-03-30 10:16:25 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Persistent is now : 2 | 2016-03-30 10:16:25 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | End Proc | 2016-03-30 10:16:25 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Begin Proc | 2016-03-30 10:16:26 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Current persistent : 1 | 2016-03-30 10:16:26 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Persistent is now : 3 | 2016-03-30 10:16:26 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | End Proc | 2016-03-30 10:16:26 *


You can see the persistent being set to 2, and on the next call, it's back to 1


In all the other cases, here's what happens. (for instance, here's a test without clicking on Apply before OK)

Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Begin Proc | 2016-03-30 10:19:07 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Current persistent : 0 | 2016-03-30 10:19:07 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Persistent is now : 1 | 2016-03-30 10:19:07 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | End Proc | 2016-03-30 10:19:07 *
CL-201605-NYMEX 5 Min #1 | Reloading chart. | 2016-03-30 10:19:07
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Begin Proc | 2016-03-30 10:19:08 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Current persistent : 1 | 2016-03-30 10:19:08 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | Persistent is now : 2 | 2016-03-30 10:19:08 *
Chart: CL-201605-NYMEX 5 Min #1 | Study: Persistent test | End Proc | 2016-03-30 10:19:08 *


This is the expected result
attachmenttestalloc.cpp - Attached On 2016-03-30 08:23:25 UTC - Size: 714 B - 384 views
[2016-03-30 16:38:13]
Sierra Chart Engineering - Posts: 104368
We will need to test this. There is going to be some explanation why this is happening.
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
[2016-04-15 04:48:49]
Sierra Chart Engineering - Posts: 104368
We are testing this now.
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
[2016-04-15 05:45:24]
Sierra Chart Engineering - Posts: 104368
This is what we get following the steps given in post #1:
Chart: YMM16 1 Min #1 | Study: Persistent test | Begin Proc | 2016-04-15 01:43:55 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Current persistent : 0 | 2016-04-15 01:43:55 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Persistent is now : 1 | 2016-04-15 01:43:55 *
Chart: YMM16 1 Min #1 | Study: Persistent test | End Proc | 2016-04-15 01:43:55 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Begin Proc | 2016-04-15 01:43:56 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Current persistent : 1 | 2016-04-15 01:43:56 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Persistent is now : 2 | 2016-04-15 01:43:56 *
Chart: YMM16 1 Min #1 | Study: Persistent test | End Proc | 2016-04-15 01:43:56 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Begin Proc | 2016-04-15 01:44:53 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Current persistent : 2 | 2016-04-15 01:44:53 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Persistent is now : 3 | 2016-04-15 01:44:53 *
Chart: YMM16 1 Min #1 | Study: Persistent test | End Proc | 2016-04-15 01:44:53 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Begin Proc | 2016-04-15 01:45:01 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Current persistent : 3 | 2016-04-15 01:45:01 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Persistent is now : 4 | 2016-04-15 01:45:01 *
Chart: YMM16 1 Min #1 | Study: Persistent test | End Proc | 2016-04-15 01:45:01 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Begin Proc | 2016-04-15 01:45:03 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Current persistent : 4 | 2016-04-15 01:45:03 *
Chart: YMM16 1 Min #1 | Study: Persistent test | Persistent is now : 5 | 2016-04-15 01:45:03 *
Chart: YMM16 1 Min #1 | Study: Persistent test | End Proc | 2016-04-15 01:45:03 *

This is after clicking apply about three times.
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
Date Time Of Last Edit: 2016-04-15 05:45:39
[2016-04-15 06:40:27]
gomifromparis - Posts: 244
I found out sometimes you're lucky :-)
Can you try :
1 Open a 5 min 30 days CL chart
2 Add the indicator
3 Click Apply
3 Wait 10 seconds
4 Click OK
[2016-04-15 18:19:17]
Sierra Chart Engineering - Posts: 104368
Yes, we were able to duplicate this but the code is not written properly to begin with.

We made the following changes:
SCSFExport scsf_PersistTest(SCStudyInterfaceRef sc)
{
  static int nb=0;

  if (sc.SetDefaults)
  {
    sc.GraphName = "Persistent test";
    sc.AutoLoop = 1;
    sc.FreeDLL = 0;
    sc.MaintainVolumeAtPriceData = 1;
    return;
  }

  SCString Buffer;

  if (sc.Index == 0)
  {
    sc.AddMessageToLog("Begin Proc",1);

    int& i=sc.GetPersistentInt(0);
    Buffer.Format("Current persistent : %d", i);
    sc.AddMessageToLog(Buffer,1);

    i++;

    Buffer.Format("Persistent is now : %d", i);
    sc.AddMessageToLog(Buffer,1);

    sc.AddMessageToLog("End Proc",1);
  }

  return;


}

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