Support Board
Date/Time: Fri, 10 Jan 2025 21:59:39 +0000
[Programming Help] - You may have a bug
View Count: 711
[2016-10-10 13:48:16] |
bala - Posts: 74 |
case: Persistent vars lose value on testing for IF ++++++++++++++++++++++++++ SCSFExport scsf_Mytest2(SCStudyGraphRef sc) {***** ****** int& testvar = sc.GetPersistentInt(10); int a; if (sc.INdex == 0){ testvar =100;} if (sc.Index > 5){ a=testvar;} // a should be 100 but actually it is 0. Is the persistent variable testvar loses it's value on the IF test? // workaround int& testvar = sc.GetPersistentInt(10); int& testvarREF = sc.GetPersistentInt(10); int a; if (sc.INdex == 0){ testvar =100;testvarREF = testvar;} if (sc.Index > 5){ a=testvarREF;} // a shows a value of 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Thanks |
[2016-10-10 14:08:33] |
bala - Posts: 74 |
Sorry there is an error on the above The test is this int& testvar = sc.GetPersistentInt(10); int a; if (sc.INdex == 0){ testvar =100;} if (sc.Index > 5 && testvar > 100){ a=testvar;} //ANYTIME I HAVE A PERSISTENT VARIABLE AND I USE IT (EXAMPLE: IF TEST) THE VARIABLE IS RESET. IT DOES NOT APPEAR TO BE PERSISTENT |
[2016-10-10 16:51:38] |
Sierra Chart Engineering - Posts: 104368 |
We do not provide programming help. Refer to the documentation here: sc.GetPersistentInt() Also, there could not possibly be a bug in Sierra Chart with 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, *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: