Support Board
Date/Time: Thu, 05 Dec 2024 19:19:14 +0000
[Programming Help] - Labels display on right hand side of chart
View Count: 524
[2023-11-16 06:49:27] |
user08187 - Posts: 15 |
Hi Is there a study, that takes a .csv or .txt file containing several price and name combos(e.g., 1.08560:Label 1,1.08540:Label 2, etc.), and displays them on the right hand side of chart along the price axis but on the chart. Please find attached image for further information Thanks Date Time Of Last Edit: 2023-11-16 08:47:07
|
Study Request.jpg / V - Attached On 2023-11-16 08:45:49 UTC - Size: 144.05 KB - 114 views Attachment Deleted. |
[2023-11-16 16:02:19] |
Sierra_Chart Engineering - Posts: 17393 |
We do not know what the question is here.
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 |
[2023-11-16 19:19:52] |
John - SC Support - Posts: 36488 |
There is not a study that reads in data from a file to be displayed. This is something you would have to develop. But, in terms of displaying the information on the edge like that, you would use the "Name Label" for a subgraph to display the information. Refer to the following: Chart Studies: Subgraphs Tab >> Name and Value Labels For example, you could enter the values into a "Horizontal Lines" study, or a "Spreadsheet Study" and then set the subgraphs to display as "Name and Value Labels Only" and then set the Name Label as you want it to show up. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2023-12-03 14:05:46] |
user08187 - Posts: 15 |
Hi, Thanks for the "Horizontal Lines" study suggestion. As per your suggestion, I've coded a custom study similar to Horizontal lines study, but I have a few questions regarding that. SCInputRef fileName = sc.Input[0]; if (sc.SetDefaults) { sc.GraphName = "NamesAndValues"; sc.StudyDescription = "Names And Values"; sc.GraphRegion = 0; fileName.Name = "File Name"; fileName.SetString("InFile.txt"); sc.AutoLoop = 1; return; } // Section 2 - Do data processing here if (!sc.IsFullRecalculation) return; SCString fileNameString = fileName.GetString(); if (fileNameString.IsEmpty()) { return; } auto index = 0; const std::string delimiter = ","; std::ifstream input(fileNameString); for (std::string line; getline(input, line); ) { auto pos = line.find(delimiter); auto symbol = line.substr(0, pos); auto scSymbol = sc.Symbol.GetChars(); if (strcmp(scSymbol,symbol.c_str()) == 0) { line = line.substr(pos+1); pos = line.find(delimiter); auto label = line.substr(0, pos); auto value = line.substr(pos + 1); sc.Subgraph[index].Name = label.c_str(); sc.Subgraph[index][sc.Index] = stof(value); sc.Subgraph[index].DisplayNameValueInDataLine = 0; sc.Subgraph[index].DisplayNameValueInWindowsFlags = 0; sc.Subgraph[index].IncludeInStudySummary = 0; sc.Subgraph[index].DrawStyle = DRAWSTYLE_TRANSPARENT_TEXT; sc.Subgraph[index].LineLabel = LL_DISPLAY_NAME | LL_NAME_ALIGN_CENTER | LL_NAME_ALIGN_LEFT_EDGE; sc.Subgraph[index].UseLabelsColor = 1; sc.Subgraph[index].LabelsColor = RGB(255, 0, 0); index++; } } input.close(); my input file has lines like below ESZ3.CME,Name1,4610
ESZ3.CME,Name2,4560 Questions(in the decreasing order of importance): 1. the custom study doesn't display Value on the price axis, like how "Horizontal Lines" display Value on the price axis(see the attached image). What needs to be added/changed in the code? 2. while the chart is loading, I wanted the study to be executed only once and not for each bars on the chart. But, if I put "sc.AutoLoop = 0", it's not displaying any Name Value pairs. What needs to be added/changed in the code? 3. In addition to being executed only once while loading, I wanted the study to be executed only when I wanted to recalculate. Is the code("if (!sc.IsFullRecalculation) return;") correct for that? 4. what needs to be added in the code, so that I don't want to display Custom Study Name, Subgraph Name and Value, Input Values, etc. in the Chart Values for tools, Top of Chart(i.e., after SYMBOL BARPERIOD ... ), etc.? Thanks |
SierraChart_CustomStudy_doubts.jpg / V - Attached On 2023-12-03 13:49:31 UTC - Size: 197.14 KB - 90 views |
[2023-12-13 10:25:51] |
user08187 - Posts: 15 |
Hi, Could you please clarify the doubts that I have raised in my prior reply. Thanks |
[2024-01-18 19:04:31] |
user08187 - Posts: 15 |
Hi, Could you please clarify the doubts that I have raised above a long back and still waiting for your reply. Thanks |
To post a message in this thread, you need to log in with your Sierra Chart account: