Support Board
Date/Time: Thu, 28 Nov 2024 01:48:52 +0000
Post From: Scope of Persistent Variables in sc.SetDefaults Code Block
[2023-06-12 18:44:56] |
SavantTrader - Posts: 110 |
The ACSIL documentation on persistent variables states: You can get and set persistent variables in the sc.SetDefaults code block at the top of the study function.
However, when I set (create) PV's in the sc.SetDefaults block: if (sc.SetDefaults)
{ [... snipped ...] int& crowned = sc.GetPersistentIntFast(1); return; } The compiler complains they're not visible elsewhere: scsf_AuctionStudy(SCStudyInterfaceRef)':
SavantStudies.cpp:3330:3: error: 'crowned' was not declared in this scope; did you mean 'round'? 3330 | crowned = 0; Can someone explain this to me? What is the purpose of setting (thus creating) persistent vars in the SetDefaults code block if they have no visibility outside the block? |