I wonder whether there's a way in WL8 (via code) to label a bar (below and above) with a textbox (like in the example below in Tradingview)?
Rename
Theoretically you should be able to accomplish this using SetTextDrawingOptions, minus the little triangular callout. But I see that it's not behaving correctly since the WL8 migration, so I corrected it for Build 22. After that the code below should work:
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (idx > bars.Count - 100) { int n = (int)((idx * 123.0) % 7.0); if ((idx * 32.0) % 3.0 == 0) { DrawBarAnnotation(n.ToString(), idx, false, WLColor.White, 10); if (idx > bars.Count - 20) { if (!drawn) { drawn = true; SetTextDrawingOptions(WLColor.Magenta, WLColor.Magenta, 1); DrawBarAnnotation("XO", idx, false, WLColor.White, 14); SetTextDrawingOptions(WLColor.Transparent, WLColor.Transparent, 0); } } } } } //declare private variables below private bool drawn = false; } }
Your Response
Post
Edit Post
Login is required