Login Page - Create Account

Support Board


Date/Time: Sat, 07 Sep 2024 23:59:50 +0000



Change plot style for current bar

View Count: 1099

[2014-12-22 20:15:50]
WarEagle - Posts: 73
I would like to be able to change the style or somehow highlight the value of an indicator on the current bar. I wrote an indicator that plots ahead on the chart so I have to use the cross-hairs to see the current value. If I could change the current plot on the indicator to either a thicker plot (see attached pic from another platform) or even a different style like a bar instead of a line that would be great. I tried using

if(sc.Index == sc.IndexOfLastVisibleBar) MyIndicator.DrawStyle = DRAWSTYLE_BAR;


but this changes the entire plot style from the beginning. I have also considered using a separate subgraph with the same indicator value but a different plot style, however I don't know how to get it to show only on the current bar. Would that be possible?

Thanks in advance.
imagehighlight_current_value.jpg / V - Attached On 2014-12-22 20:10:17 UTC - Size: 8.74 KB - 327 views
[2014-12-22 20:31:04]
Sierra Chart Engineering - Posts: 104368
For this you need to use a different Subgraph. You will only set values for it for the last bar and clear the others.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-12-22 23:19:00]
WarEagle - Posts: 73
Ok thanks, that worked great. Here is the code I used for anyone searching in the future.


//Subgraphs
SCSubgraphRef MyIndicator = sc.Subgraph[0];
SCSubgraphRef MyIndicator2 = sc.Subgraph[1]

then in SetDefaults...


if (sc.SetDefaults)
  {
    MyIndicator.DrawStyle = DRAWSTYLE_LINE;
    
    MyIndicator2.Name = "Current Value Plot";
    MyIndicator2.DrawStyle = DRAWSTYLE_POINT;
MyIndicator2.LineWidth = 3;
    MyIndicator2.DrawZeros = 0;
}

and then the plots...


MyIndicator2[sc.Index] = 0;
if(sc.Index == sc.IndexOfLastVisibleBar) MyIndicator2[sc.Index] = MyIndicator[sc.Index];

Hope that helps.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account