Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 19:14:19 +0000



[User Discussion] - How to draw rectangle using ACSIL that occupy all of bar space?

View Count: 4751

[2013-08-05 20:54:52]
TrueBalance - Posts: 4
Is it possible (using ACSIL) to draw rectangles that occupy all of the bar space?

I have tried stuff like:


tool1.BeginDateTime = sc.BaseDateTimeIn[sc.Index] - (sc.SecondsPerBar * SECONDS)/2;
tool1.EndDateTime = sc.BaseDateTimeIn[sc.Index] + (sc.SecondsPerBar * SECONDS)/2;
    

Needless to say, it doesn't work. I'd appreciate any ideas on how to accomplish this.

EDIT: I can't use "background color" for this as I will be drawing several different rectangles vertically (not shown in the attached image).
Date Time Of Last Edit: 2013-08-05 21:02:42
imagesc-draw-rect.png / V - Attached On 2013-08-05 20:54:23 UTC - Size: 69.55 KB - 731 views
[2013-08-06 08:32:21]
Hendrixon - Posts: 130
Happened to me when I built a numbers bars study.
You can't use the rectangle tool since it draws from index to index or datetime to datetime, which always fall on the middle of a bar.
The only workaround I found is to draw a vertical line and give it some width.
Not the Vertical Line Tool.... just a simple line with a start and an end that make it vertical.

There is still a problem that if you change the chart's bars spacing/width, your "bars" won't change width since they are of course hard coded to a fixed pixel width.
If you do need it to follow changing bar spacing/width, its more complicated. you need to monitor the chart's spacing thru acsil, and give your bars a width option for every chart spacing (if-elseif-elseif-elseif etc).
From memory I remember needing to do something like this (though with horizontal lines) since it wasn't as simple as finding a single factor to do "my bar width = chart spacing * factor".


Good luck.
Date Time Of Last Edit: 2013-08-06 08:33:58
[2013-08-06 08:36:09]
Sierra Chart Engineering - Posts: 104368
You cannot do this automatically, however you can use the Bar Top and Bar Bottom Draw Style pair and set the width in pixels to what you require.
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
[2013-08-06 18:07:46]
TrueBalance - Posts: 4
Thanks Hendrixon, great idea. I never thought of drawing vertical line segments, that will do the trick. Together with the value of "sg.ChartBarSpacing" and "sg.SpaceBetweenChartBars" it should pretty much work automatically even if the bar width is changed.

Sierra Chart Engineering - thanks, I'll look into that draw style, might be the same as drawing line segments if I understand it correctly.

Date Time Of Last Edit: 2013-08-06 18:09:54

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

Login

Login Page - Create Account