Support Board
Date/Time: Mon, 10 Mar 2025 14:11:43 +0000
Crosshair lines auto hide
View Count: 919
[2022-03-30 22:43:29] |
Trader & Sierra++ developer - Posts: 110 |
Hi Sierra, Using global cursor, very often my charts end with a vertical line hiding the last bar of the charts (typically when working on a short timeframe : medium and high timeframe charts are always on the last bar). Would it be possible to add an option to auto hide crosshair lines after a few seconds and show it back on the next mouse move ? I’ve searched a way to code a study for this but i didn’t find any ACSIL member or method to control crosshair. Thanks |
[2022-03-31 01:13:33] |
Tony - Posts: 553 |
Here is a possible solution: What I am doing is that I always have Crosshair hidden, and in my studies, I either use vertical/horizontal lines or subgraphs to follow "sc.ActiveToolIndex", "sc.ActiveToolYPosition" or "sc.ActiveToolYValu" when "Chart Value/Crosshair" tool is selected. As long as your chart update interval is short enough, say 250ms, you should have a fairly smooth movement. It could be a bit tricky how to switch between "show" and "hide" those lines and subgraphs, I made it happen by clicking on certain area/corner inside the chart window. Date Time Of Last Edit: 2022-03-31 01:16:49
|
[2022-03-31 05:09:17] |
Trader & Sierra++ developer - Posts: 110 |
You can dynamically show/hide a subgraph from your study by setting its .Name to an empty string. My idea was just to control the high level parameters like « use global cursor » from a study, so that there aren’t any performance nor responsiveness loss. I was not considering coding another crosshair tool (that would most probably be less performant and responsive than native), but this is worth testing it, thanks for the tip. |
[2022-03-31 12:09:37] |
Trader & Sierra++ developer - Posts: 110 |
Hi Tony, Well, after a few hours coding a study to replace the crosshair, everything is OK except that sc.ActiveToolYValue is NOT updated on the other charts with the same symbol. It is ok with activeToolIndex (vertical line) but not activeToolYValue nor any price related member or function (horizontal line). Global Cursor behaviour cannot be reimplemented, i'm stuck. How did you manage to follow the price between charts with the same symbol ? Date Time Of Last Edit: 2022-03-31 12:16:26
|
[2022-03-31 12:23:11] |
Trader & Sierra++ developer - Posts: 110 |
+ Question for Sierra : instead of adding auto-hide feature, another feature request that is probably much faster to code (and quite obvious actually) : hide the crosshair vertical line when the mouse is over the right scale. Could you please consider this ? Date Time Of Last Edit: 2022-03-31 12:23:20
|
[2022-03-31 14:48:20] |
Tony - Posts: 553 |
Well, after a few hours coding a study to replace the crosshair, everything is OK except that sc.ActiveToolYValue is NOT updated on the other charts with the same symbol. It is ok with activeToolIndex (vertical line) but not activeToolYValue nor any price related member or function (horizontal line). Global Cursor behaviour cannot be reimplemented, i'm stuck. How did you manage to follow the price between charts with the same symbol ? That's the easy part, I assume all your studies are in the same .cpp file, all you need is a global variable, and that can be accessed by all studies, even in different charts of same chart book (assume Study1 is loaded in chart #1 and Study2 is loaded in chart #2, same chart book): #include "sierrachart.h" SCDLLName("dll_file") double VerticalValue {0.0}; SCSFExport scsf_Study1(SCStudyInterfaceRef sc) { // other codes VerticalValue = sc.ActiveToolYValue; // other codes } SCSFExport scsf_Study2(SCStudyInterfaceRef sc) { double Value_Needed_To_Draw_Crosshair {0.0}; // other codes Value_Needed_To_Draw_Crosshair = VerticalValue; // other codes } I haven't tried this way, but I use global variables a lot, the only downside for crosshair lines is that there will be a slight delay on chart #2, if your computer is fast enough (mine is not, I set 250ms on my 2015 iMac), you could set update interval to, say 100ms or shorter, then you won't notice any delay. Date Time Of Last Edit: 2022-05-28 04:57:54
|
[2022-03-31 15:36:44] |
Trader & Sierra++ developer - Posts: 110 |
Oh yes, I would have never thought of this because I don't like global vars and avoid them as much as possible. Great solution here, thank you. Yes such a study is less responsive, and it consumes CPU (even more now that it needs to store a list of symbol prices, and to find & store price on each call of each study) but I'm ok with that : it is so annoying to have always the most important part of the chart (the last bar) hidden or confused by a vertical line... And now I have exactly the behaviour I need. Thank you again. Date Time Of Last Edit: 2022-03-31 15:59:59
|
To post a message in this thread, you need to log in with your Sierra Chart account: