Hello,
I'm trying to do a new strategy and just would like to test the following code (it's the code from documentation to have a custom rendering on a strategy) :
namespace Tickblaze.Scripts.Strategies;
public class ClosePriceLine : Strategy
{
[Parameter("Line Color", Description = "Color of the custom line")]
public Color LineColor { get; set; } = Color.Blue;
[Parameter("Line Thickness", Description = "Thickness of the custom line"), NumericRange(1)]
public int LineThickness { get; set; } = 2;
[Parameter("Line Style", Description = "Style of the custom line")]
public LineStyle LineStyle { get; set; } = LineStyle.Solid;
public override void OnRender(IDrawingContext context)
{
var points = new List<Point>();
for (var barIndex = Chart.FirstVisibleBarIndex; barIndex <= Chart.LastVisibleBarIndex; barIndex++)
{
var point = new Point()
{
X = Chart.GetXCoordinateByBarIndex(barIndex),
Y = ChartScale.GetYCoordinateByValue(Bars[barIndex].Close)
};
points.Add(point);
}
context.DrawPolygon(points, null, LineColor, LineThickness, LineStyle);
}
}
I'm in debug with Visual studio. Everything works fine with other methods (like OnBar) but when launching the strategy ahead with the Replay engine I can't have the debug to enter in the OnRender method...Do you know what is happening ?
Best regards
HPI