Support Board
Date/Time: Fri, 27 Dec 2024 00:46:05 +0000
Percentage Scales on Charts based on first visible bar
View Count: 2164
[2016-03-02 03:15:56] |
Dema - Posts: 42 |
Hi Team, I am needing help to plot a percentage % scale chart. The % change is based on the difference from the first visible bar/line value. For example on this screenshot from Investing.com charting, you can see the Oil chart with Gold and S&P500 overlays as %'s away from a 0% origin. https://gyazo.com/60f97e6deedc0f5095e4bdec809f89a8 Thankyou. |
[2016-03-02 04:16:09] |
Sierra Chart Engineering - Posts: 104368 |
Use this study: http://www.sierrachart.com/index.php?page=doc/doc_TechnicalStudiesReference.html#s174 Here are instructions to use a study: http://www.sierrachart.com/index.php?page=doc/doc_ChartStudies.html#AddingModifyingStudies 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 |
[2016-03-02 04:37:55] |
Dema - Posts: 42 |
Thanks team for the quick response! What I was after was a 0% origin taken from the first visible bar currently on the chart. Refer screenshot: http://www.sierrachart.com/image.php?l=1456893435940.png |
[2016-03-03 04:02:48] |
Sierra Chart Engineering - Posts: 104368 |
It is necessary then to adjust the Days to Load and the Session Times >> Start Time to control what the first chart bar will be. Refer to: http://www.sierrachart.com/index.php?page=doc/doc_ChartSettings.html 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 Date Time Of Last Edit: 2016-03-03 04:03:08
|
[2016-03-03 10:36:24] |
Dema - Posts: 42 |
Hi Team, Unfortunately that will not suit my requirements because I will be zooming in & out and scrolling back & forth, and need the percentage origin to be from whatever the first currently visible bar is. I would classify this as a feature request/enhancement. If you are able to supply me with the latest source code for the "Percent Change Since Open" study I would be happy to expand the code to suit this requirement and provide the updated source code back to you for inclusion in the User Contributed Studies or as you see fit. Many thanks. |
[2016-03-03 18:32:06] |
Sierra Chart Engineering - Posts: 104368 |
This is not a feature we would add. The source code is already available. Refer to: http://www.sierrachart.com/index.php?page=doc/doc_BuildCustomStudiesDLL.html 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 |
[2016-03-13 06:51:55] |
Dema - Posts: 42 |
Hi Team, I have attempted to code this feature (see below), however, the chart requires a manual recalculate (Ctrl+Ins) upon scrolling/zooming which is not practical. The global update interval is default 500ms and there is no override on the chart. Could you please suggest why the auto-loop isn't being triggered automatically? I do have sc.UpdateAlways = 1. Thankyou. SCSFExport scsf_PercentageChangeVisible_AutoLoop(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Percentage Line AUTO Loop DZ"; sc.StudyDescription = "Percentage Line AUTO Loop calculates percentage change from first visible bar"; sc.AutoLoop = 1; sc.FreeDLL = 1; sc.UpdateAlways = 1; sc.Subgraph[0].Name = "LAST Line"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; sc.Subgraph[0].LineStyle = LINESTYLE_DOT; sc.Subgraph[0].DrawZeros = 1; return; } if(sc.Index == 0 || sc.Index <= sc.IndexOfFirstVisibleBar) { sc.Subgraph[0][sc.Index] = 0.0f; } else { sc.Subgraph[0][sc.Index] = 100.0f * (sc.BaseData[SC_LAST][sc.Index] - sc.BaseData[SC_LAST][sc.IndexOfFirstVisibleBar]) / sc.BaseData[SC_LAST][sc.IndexOfFirstVisibleBar]; } } |
[2016-03-13 09:08:44] |
Sierra Chart Engineering - Posts: 104368 |
sc.UpdateAlways = 1 will not cause a full recalculation. Setting sc.FlagFullRecalculate = 1 at the time you want a full recalculation will cause that. However, there is a better way. Set sc.AutoLoop = 0 to use manual looping. Anytime the study function is then called, perform a full recalculation as required. 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 Date Time Of Last Edit: 2016-03-13 09:09:02
|
[2016-03-13 11:45:08] |
Dema - Posts: 42 |
Excellent I will do that, thankyou for the prompt suggestion! Could you please confirm if sc.UpdateAlways = 1 needs to be set for when sc.AutoLoop = 0? |
[2016-03-13 19:15:38] |
Sierra Chart Engineering - Posts: 104368 |
If you want the study function continuously called, then yes.
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 |
To post a message in this thread, you need to log in with your Sierra Chart account: