Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 11:22:01 +0000



[User Discussion] - ACSIL global variables

View Count: 2924

[2014-01-29 06:28:18]
User40117 - Posts: 56
hi,

before i do my indicator calculations i need to compute some 'global' variables like average volume, avg price move etc... so i need to loop once through the bars. Next with automated looping my indicator is computed. The global variables don't need to be re-computed when new bars are added, only when f.e. more historical data is loaded.

How can i achieve this one-time variables calculation ?

ty !
[2014-01-29 23:42:37]
Sierra Chart Engineering - Posts: 104368
Have a look at this section here:
https://www.sierrachart.com/index.php?l=doc/doc_ACSILProgrammingConcepts.html#GlobalVariables

It explains global variables and also makes reference to Persistent Variables. Sounds like you want to use Persistent Variables.
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
[2014-01-30 07:08:15]
User40117 - Posts: 56
ty,

indd persistent is probably what i need.

however, it is not clear to me how i would compute f.e. an average volume of all bars and define it as a variable.
I cannot loop within sc.setdefaults because the data array is empty.

the average volume is used in the loop but yet not defined...

So i would need to go through all data first and when the persistent variable is defined the automated loop can start the calculations for the indicator...
Not sure how to achieve this in a clean way.



[2014-01-30 07:22:38]
User40117 - Posts: 56
http://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#DLLCalling

by calling a secondary function first maybe ?
[2014-01-30 11:47:54]
User40117 - Posts: 56
if(sc.Index == 0)
{


}

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

Login

Login Page - Create Account