Variable Bar Width Study
|April 9th, 2013, 10:11 PM||#1 (permalink)|
Futures Experience: None
Favorite Futures: Various
Posts: 4,898 since Jan 2011
Thanks: 5,143 given, 11,193 received
Variable Bar Width Study
One of the biggest pet peeves I have is when I change the bar width on a chart, and study/indicator bars do not change with it. It's one thing I miss about Investor R/T, my volume bars would always resize when I change my bar spacing on the chart, and would basically be the maximum size they could be without running together.
So, a while back I wrote a simple SC study that would accomplish the same thing, and after seeing someone's chart today with squished up volume bars (that would be @GaryD ), I thought I would compile it and share it.
So to do this, put the DLL in your Sierra Data folder (and if you like, put the source in the ACS_Source folder too). When you want to add a study that has bars as the draw type and want them to change dynamically with the bar spacing of your chart, add the study and make it invisible. Then add this custom study (it should be under the Variable Bar Width category which you can change by modifying the SCDLLName() call at the top of the source file and recompiling). In the study parameters, have "Based On" set to your study that you just hid, and be sure it's in the correct region, and that scale settings are appropriate as well.
By default, the study bars will be as wide as they can be and should have only a small space between them. When you compress the bars, the study bars will compress to maintain this spacing. However, if you wish to make the bars a little narrower, change the Offset study input to a negative number and this reduced bar width (additional spacing) will be maintained as you resize the bar spacing on the chart.
I have also included a study collection file that you can put in your Data folder as well, that has the settings preset for volume, so that if you choose Analysis->Vol, you will have a dynamically changing Volume study.
The study enables "update always" which means that whatever you update interval is set to in your general settings, this chart will update always at that interval, regardless of whether you have data coming in or not. This is so it works instantly, and will work correctly if you are using it on the weekend for example, when markets are closed and no data is coming in to update the chart. Honestly I don't think there is a performance hit for normal use, because data comes in usually at much faster than the update interval, and SC capped the update interval at 100ms for "update always" functionality anyway, so it's really not that big of a deal IMO.
As a disclaimer, this works fine for me, but I take no responsibility if you add it and something goes wrong