Support Board
Date/Time: Tue, 26 Nov 2024 04:21:54 +0000
[Programming Help] - GetPersistentInt() help
View Count: 554
[2023-12-31 16:59:42] |
User895355 - Posts: 55 |
I need to get a better handle on using GetPersistentInt(). My Tool autoloops and draws a horizontal line at each of the market sessions. ie: NY 9:30-16:00; LONDON 3:00 - 11:00, etc. If I just set sc.GetPersistentInt(1) it's fine because it will only be the "last" session and none of the historical lines will be drawn. However, I have a flag "ShowHistorical" and if set to "true" ALL the historical lines will be drawn. How do I ensure the GetPersistentInt()'s will be unique then? I've tried several ways of dynamically creating integers for the persistentInts, but none of these are working. Please point me in the right direction.
Date Time Of Last Edit: 2023-12-31 22:48:31
|
[2024-01-01 20:04:04] |
Sierra_Chart Engineering - Posts: 17179 |
We are not understanding the question. Full documentation is here: sc.GetPersistentInt() 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, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-01 20:43:42] |
User895355 - Posts: 55 |
Every session, London, New York, Asia, I draw the high and lows for the opening. Going back a month or so. If I want to display each session, then each Tool must have it's unique PersistentInt. My question is what is the best way to do this? Here is my code regarding that: // line numbers int &HighTool_LineNumber = ShowAll.GetYesNo() == 0 ? sc.GetPersistentInt(1) : sc.GetPersistentInt(currentDate); int &MedianTool_LineNumber = ShowAll.GetYesNo() == 0 ? sc.GetPersistentInt(2) : sc.GetPersistentInt((currentDate) * 2); int &QuartileUpTool_LineNumber = ShowAll.GetYesNo() == 0 ? sc.GetPersistentInt(3) : sc.GetPersistentInt((currentDate) * 3); int &QuartileDownTool_LineNumber = ShowAll.GetYesNo() == 0 ? sc.GetPersistentInt(4) : sc.GetPersistentInt((currentDate) * 4); int &LowTool_LineNumber = ShowAll.GetYesNo() == 0 ? sc.GetPersistentInt(5) : sc.GetPersistentInt((currentDate) * 5); I've been using current date which is int currentDate = sc.BaseDateTimeIn[sc.Index].GetDate();
Still some of my tools don't show. |
[2024-01-01 21:25:33] |
Sierra_Chart Engineering - Posts: 17179 |
This thread is now marked as programming help. We do not provide programming help.
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, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-01-02 22:22:02] |
PS2004 - Posts: 47 |
Hi! I encountered this problem too during my time developing Custom Studies. I would recommend you to check out this part about drawing with Tools: Using Drawing Tools From an Advanced Custom Study: s_UseTool::AddMethod The thing you are probably looking for is the s_UseTool::AddMethod .Set it to UTAM_ADD_ALWAYS and the line will be added with the PersistentInt you use as LineNumber.If you delete that LineNumber later, every Tool with that PersistentInt will disappear. Use as many PersistentInts as you need for each line type. I am happy to clarify the method I suggest, reply if it is not clear. Greetings, PS |
To post a message in this thread, you need to log in with your Sierra Chart account: