- ago
C# - Where can we access the chart color preferences like Down Bar, Background, etc.?

Color myColor = ???

Thanks...
0
3,326
Solved
5 Replies

Reply

Bookmark

Sort
- ago
#1
Are you looking for ChartDisplaySettings? It's documented with examples in the QuickRef.
0
Cone8
 ( 26.65% )
- ago
#2
The ChartDisplaySettings class isn't easy to find in the QuickRef because it's described in SetChartDrawingOptions. We should probably break out that class and make a reference to SetChartDrawingOptions.

I don't see a way to access the preferences, but the above gives your strategy all the control to customize just about everything.
1
- ago
#3
If you're looking for color names you can pass into your WL graphic calls, check out this website. https://www.w3schools.com/colors/colors_groups.asp For example, Color.Green and Color.OrangeRed below:

CODE:
PlotTimeSeriesLine(decorrelated, bars.Symbol + " decorrelated", "decorrelated", Color.Green, 2, LineStyles.Solid); DrawHeaderText("Buy " + bars.Synbol + (idx+1).ToString(" @bar 000: ") + topBuysString.ToString(), Color.OrangeRed, 10, "decorrelated");
1
- ago
#4
Thanks Cone and Ticker... The goal is the apply colors from the preference rather than the current code... casting system colors... RJ
0
Glitch8
 ( 8.38% )
- ago
#5
This will do it - some undocumented parts of the framework here, thanks for blazing this trail! We do have an internal task issue to document these :)

CODE:
using WealthLab.Backtest; using System.Drawing; using WealthLab.Core; using WealthLab.ChartWPF; using WealthLab.WPF; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //Initialize public override void Initialize(BarHistory bars) {          //get the current ChartPreferences (theme)          ChartPreferences cp = ChartThemeFactory.SelectedTheme;                    //they are WPF Colors, so use this extension method to convert them to System.Drawing Colors          Color colorUpBars = cp.ColorUpBar.ToGdiColor();          Color colorDownBars = cp.ColorDownBar.ToGdiColor(); } //Execute public override void Execute(BarHistory bars, int idx) { if (OpenPositions.Count == 0) { } else { } } //private members } }
1
Best Answer

Reply

Bookmark

Sort