I created a strategy with the strategy wizard and referencing some custom indicators that I created. The indicators plot fine on charts, but they will not plot on the strategy chart. (As an aside, I can't get the strategy to respond to the indicator either, so something is goofy).
After a lot of searching, I have come up with this code:
protected override void Initialize()
{
CalculateOnBarClose = true;
Add(PeriodType.Day,1);
Add(PeriodType.Week, 1);
//Weekly Momentum plot
Add(StrategyPlot(0));
//Weekly Momentum slope plot
Add(StrategyPlot(1));
StrategyPlot(0).Plots[0].Pen.Color = Color.Blue;
StrategyPlot(0).PanelUI = 2;
StrategyPlot(1).Plots[0].PlotStyle = PlotStyle.Bar;
StrategyPlot(1).Plots[0].Pen.Color = Color.Aquamarine;
StrategyPlot(1).PanelUI = 2;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
//Plots
StrategyPlot(0).Value.Set(EMAMomentum(Closes[2], 12, 10).Plot0[0]);
StrategyPlot(1).Value.Set(EMAMomentumSlope(Closes[2], 12, 10, 3).Plot0[0]);

Comment