- ago
While we can work around with DrawText, font control for DrawBarAnnotation would be nice to have.

Thanks... Rick

Example. Tagging PeakTrough DetectedAt bars with Wingding arrows.
0
788
Solved
4 Replies

Reply

Bookmark

Sort
- ago
#1
All .NET framework strings will take 16-bit Unicode characters. So if you simply substitute one of the Unicode characters for the up-arrow and down-arrow, you have what you want without changing fonts. https://unicode-table.com/en/sets/arrow-symbols/#up-arrows

CODE:
using WealthLab.Backtest; using WealthLab.Core; using System.Drawing; namespace WealthScript3 { public class MyStrategy : UserStrategyBase { public override void Execute(BarHistory bars, int idx) {     if (idx == 0)             return;          if (bars.High[idx] > bars.High[idx - 1] && bars.Low[idx] < bars.Low[idx - 1])          {             bool isBullish = bars.Close[idx] > bars.Open[idx];             string annotation = isBullish ? "\u21D1" : "\u21D3";             Color c = isBullish ? Color.Green : Color.Red;             DrawBarAnnotation(annotation, idx, isBullish, c, 20);          } } } }



Is there another reason you have to change fonts for DrawBarAnnotation?
2
Glitch8
 ( 12.08% )
- ago
#3
We did add a "Font" optional parameter to the end of the method for Build 28:

CODE:
//Initialize public override void Initialize(BarHistory bars) {          DrawBarAnnotation("Above", bars.Count - 40, true, Color.Black, 12);          DrawBarAnnotation("Below", bars.Count - 40, false, Color.Black, 12, true, new Font("Wingdings", 12)); }



2
Best Answer
- ago
#4
Thank you both... WL7 features grow and I get some much-needed tutoring!
RJ
0

Reply

Bookmark

Sort