- ago
To counter the crowding, I am trying to add some spacing between annotations and observing some weird behavior.

Here is a sample code I wrote to demonstrate some of the strangeness:
CODE:
public override void Initialize(BarHistory bars) {          // These should be stacked in the order of ABC, FOO and BAR, but are stacked in the order of FOO, BAR, and ABC.          DrawBarAnnotation("\n\n\n\n\n\n1.ABC", bars.Count - 10, false, Color.Red, 14);          DrawBarAnnotation("1.FOO", bars.Count - 10, false, Color.Red, 14);          DrawBarAnnotation("1.BAR", bars.Count - 10, false, Color.Red, 14);          // These strings should stack on each other and should not overwrite          DrawBarAnnotation("\n2.ABC", bars.Count - 20, false, Color.Blue, 14);          DrawBarAnnotation("2.FOO", bars.Count - 20, false, Color.Blue, 14);          DrawBarAnnotation("2.BAR", bars.Count - 20, false, Color.Blue, 14);          // This should have the labels after spacing of five lines, but spacing is of only one line          DrawBarAnnotation("\n", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("\n", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("\n", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("\n", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("\n", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("3.FOO", bars.Count - 30, false, Color.Orange, 14);          DrawBarAnnotation("3.BAR", bars.Count - 30, false, Color.Orange, 14);       }

This is how it looks:


I have tried using " " instead of "\n", but still not able to get predictive results. How can I add few empty lines in between to get some spacing?

I am using WL7 Build 6.

0
914
Solved
4 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.67% )
- ago
#1
Try “ “?
0
- ago
#2
Cannot fix the spacing, the rest works:
CODE:
//create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) {          int fs = 14;                    // To stack in the order of ABC, add them in the reverse order          DrawBarAnnotation("1.BAR", bars.Count - 10, false, Color.Red, fs);          DrawBarAnnotation("1.FOO", bars.Count - 10, false, Color.Red, fs);          DrawBarAnnotation("1.ABC", bars.Count - 10, false, Color.Red, fs);          // To not overwrite, do not use a '\n'          DrawBarAnnotation("2.BAR", bars.Count - 20, false, Color.Blue, fs);          DrawBarAnnotation("2.FOO", bars.Count - 20, false, Color.Blue, fs);          DrawBarAnnotation("2.ABC", bars.Count - 20, false, Color.Blue, fs);          // This is the problem: cannot fix the spacing of only one line          DrawBarAnnotation("3.BAR", bars.Count - 30, false, Color.Orange, fs);          for (int spacing = 1; spacing <= 5; spacing++) DrawBarAnnotation("Placeholder", bars.Count - 30, false, Color.Transparent, fs * 5);          DrawBarAnnotation("3.FOO", bars.Count - 30, false, Color.Orange, fs);          DrawBarAnnotation("3.ABC", bars.Count - 30, false, Color.Orange, fs);       }
0
Best Answer
- ago
#3
@Glitch: " " does not work predictively. I have tried it.

Thank you Eugene for the sample code!
Color.Transparent -> this should do the trick. Instead of newline or space or empty string, I can just have dummy text with Color.Transparent and that should add empty space.
0
edwkelly8
 ( 0.03% )
- ago
#4
Bar text from DrawBarAnnotation is getting cutoff depending on centering. Is there a way to either center the series or somehow keep the text visible regardless of volatility?
0

Reply

Bookmark

Sort