Can't aligned text on Chart
Created at 07 Jan 2020, 12:52
MY
Can't aligned text on Chart
07 Jan 2020, 12:52
Hello, I have for some time trying to align text in column on the Chart but to no avail. Anyone has a solution to this problem? Please help.
The example code as follows:
string text = "\t" + "Opening Price: " + "\t" + MarketSeries.Open.Last(0) + "\t" + MarketSeries.Open.Last(1) + "\t" + MarketSeries.Open.Last(2) + "\n" + "\t" + "Target met?:" + "\t" + "No" + "\t" + "No" + "\t" + "Yes";
var description = Chart.DrawStaticText("line1", text, VerticalAlignment.Top, HorizontalAlignment.Center, Color.Blue);
cTrader Automate
@mylowsmoke
redtick123
07 Jan 2020, 17:01 ( Updated at: 21 Dec 2023, 09:21 )
It's hard to do it with static text. If you want to control alignment it's better to use custom UI controls. You can use Grid to make a table. But it is a bit complicated, for each cell you need to create a TextBlock.
I'm working on DataGrid control, that makes it easier.
1. Get class from here and paste it to your cBot or indicator:
https://raw.githubusercontent.com/redtick123/cTraderRedUI/master/DataGrid.cs
2. cBot with your example will look like this:
You can change text for cells as well foreground and background colors:
@redtick123