cBot - ChartObjects.DrawArrow
cBot - ChartObjects.DrawArrow
10 Feb 2024, 07:08
Hello all,
I have encountered difficulty in locating a suitable reference or method for incorporating arrow graphics within my cBot designed for Fractals. My objective is to visually represent the Fractal calculations by plotting distinct up and down arrows corresponding to each identified Fractal point.
Below is an example, I've attempted dozens of variations:
protected override void OnBar()
{
if (!double.IsNaN(_fractals.DownFractal.Last(1)) > topBB)
{
var fractalTime = _fractals.DownFractal.LastTime(1); ////////// I know this is incorrect, but I can't seem to determine a timestamp.
var fractalValue = _fractals.DownFractal.Last(1);
Chart.DrawIcon($"DownFractalMarker_{fractalTime}", ChartIconType.UpArrow, fractalTime, fractalValue, Color.Red);
}
I have successfully plotted my Moving Average using the following approach. However, I am curious if there exists a more efficient or optimal method for achieving the same outcome:
// PLOTS for MA1
for (int i = 1; i < _ma1.Result.Count; i++)
{
var time1 = Bars.OpenTimes[i - 1];
var value1 = _ma1.Result[i - 1];
var time2 = Bars.OpenTimes[i];
var value2 = _ma1.Result[i];
if (!double.IsNaN(value1) && !double.IsNaN(value2))
{
Chart.DrawTrendLine($"MA1 Line {i}", time1, value1, time2, value2, Color.DeepSkyBlue, 2, LineStyle.Solid);
}
}
Thank you for the help in advance.
Replies
RJM1
12 Feb 2024, 10:43
( Updated at: 13 Feb 2024, 06:51 )
RE: cBot - ChartObjects.DrawArrow
firemyst said:
Use the DrawText and select a unicode character. Visual Studio will support these, as I have a few in my code:
private const string CONST_StatusLong = "▲"; //"↑"; //"▲"; //"⬆"; //"↑"; private const string CONST_StatusShort = "▼"; //"▼"; //"⬇"; //"↓";
Hopefully you can copy/paste those and they'll work in your code.
Thank you for taking the time to reply and also sharing a great idea, much appreciated!
@RJM1
firemyst
11 Feb 2024, 12:27
Use the DrawText and select a unicode character. Visual Studio will support these, as I have a few in my code:
Hopefully you can copy/paste those and they'll work in your code.
@firemyst