How to reduce the vertical spacing between multiple annotations using AnnotateBar?
Author: istock888
Creation Date: 11/6/2017 1:13 AM
profile picture

istock888

#1
Hi,

I drew dome trading notes on a chart using AnnotateBar. As said in the WealthScript QuickRef, "Calling AnnotateBar multiple times causes the annotations to be stacked one on top of another either above or below the bar.", but the vertical spacing between the multiple annotations for a bar is too broad. Is there a way to reduce the space using something like LineSpacing?
profile picture

Eugene

#2
Hi,

If you can't find it documented in the QuickRef description and there are no properties like "LineSpacing", with good certainty such capability doesn't exist. You might experiment with the Font parameter but I don't think it would have effect.
profile picture

Cone

#3
It looks to me like either you've got some extra line feeds in your text OR there's some weird interaction with the arrow images. If you run this script below, you'll see that multiple calls of AnnotateBar() stack characters pretty well.

CODE:
Please log in to see this code.

Another thing you could try is creating a Dictionary<int, string> where you store a single string per bar number. If you have multiple strings on the same bar, you just append it to the string for that bar. A the end of the script, iterate thru the Dictionary to Annotate the bars with the store string.
profile picture

istock888

#4
Thank you guys for the info.

Cone is right. I played with the code and was able to get the correct spacing between paragraphs.
profile picture

istock888

#5
Hi Cone,

Do you have sample code of dictionary for this type of coding (<bar#, string>)? I am interested to use it.
profile picture

Eugene

#6
profile picture

Cone

#7
CODE:
Please log in to see this code.
profile picture

istock888

#8
Thank you Cone. Your sample code works really well.
Is there a way we can control the range of Y Axis, since part of my annotation is not shown limited by Y Axis min, max?
profile picture

Cone

#9
It's a bit tricky, but here's how you can increase (but not decrease) the MinMax of the visible chart -

Note! This routine add 10% more y-scale to the top of the most recent visible chart after clicking Go (F5). If you scroll backwards and prices are higher, then the normal auto-scaling takes effect.

CODE:
Please log in to see this code.
profile picture

istock888

#10
Thank you Cone for the useful info!