Support Board
Date/Time: Thu, 08 Oct 2026 12:53:38 +0000
[Programming Help] - sc.AddAndManageSingleTextUserDrawnDrawingForStudy() and sc.StorageBlock
View Count: 229
| [2026-08-24 04:14:48] |
| drinkcodejava - Posts: 47 |
|
I have a custom study that uses https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scAddAndManageSingleTextUserDrawnDrawingForStudy. The same study also uses sc.StorageBlock. According to the function documentation: void AddAndManageSingleTextUserDrawnDrawingForStudy(SCStudyInterfaceRef& sc, int Unused, int HorizontalPosition, int VerticalPosition, SCSubgraphRef Subgraph, int TransparentLabelBackground, SCString& TextToDisplay, int DrawAboveMainPriceGraph, int LockDrawing, int UseBoldFont);
The sc.AddAndManageSingleTextUserDrawnDrawingForStudy function adds a text drawing to the chart based upon the given parameters and implements the low-level management of that drawing... Internally this function uses the first four bytes of the sc.StorageBlock. Therefore, do not use the same part of the storage block in the study function that you call sc.AddAndManageSingleTextUserDrawnDrawingForStudy from. How do you avoid using the first four bytes of sc.StorageBlock? Thanks! |
| [2026-08-24 05:42:06] |
| User719512 - Posts: 495 |
|
Are you asking how to do this? // Skip the first 4 bytes reserved by AddAndManageSingleTextUserDrawnDrawingForStudy char* pMyStorage = static_cast<char*>(sc.StorageBlock) + 4; |
| [2026-08-24 14:33:21] |
| drinkcodejava - Posts: 47 |
|
Yes, thank you! But from there, how do you read/write to the offset addresses of the sc.StorageBlock members? This is my storage block structure: struct s_PermData {
int sb_Qty; float sb_Margin, sb_MarginPct; float sb_Start; }; s_PermData* PermData; PermData = (s_PermData*)sc.StorageBlock; |
| [2026-08-24 14:54:00] |
| User719512 - Posts: 495 |
|
Ask Grok or ChatGPT for some help with this if these c++ concepts are new to you. I would expect you need do to something like: s_PermData* PermData = reinterpret_cast<s_PermData*>(static_cast<char*>(sc.StorageBlock) + 4); |
To post a message in this thread, you need to log in with your Sierra Chart account:
