London, Ontario
Posts: 2 since Nov 2017
Thanks Given: 0
Thanks Received: 0
|
First post here so bear with me...although there is some great info on multitimeframe stuff I can't seem to get indicators that I code to show up on my charts within a strategy:
I want the base chart to be a minute chart
Indicators I am trying to add:
(EMA, 15, 1 minute) – RED (this one works fine)
(EMA, 15, 1 hour) – DARKGOLDENROD (doesn’t appear on chart)
(EMA, 15, 1 day) - BLUE (doesn’t appear on chart)
Here is the code:
protected override void Initialize()
{
CalculateOnBarClose = true;
//add 15 EMA to base chart (1 minute)
Add(EMA(15));
EMA(15).Plots[0].Pen.Color = Color.Red;
// Add a hourly bars object to the strategy
Add(PeriodType.Minute, 60); // BarsArray[1]
// Add a daily bars object to the strategy
Add(PeriodType.Day, 1); // BarsArray[2]
// Add 1 hour 15 period EMA indicator on the chart
Add(EMA(BarsArray[1], 15));
EMA(BarsArray[1], 15).Plots[0].Pen.Color = Color.DarkGoldenrod;
// Add daily 15 period EMA indicator on the chart
Add(EMA(BarsArray[2], 15));
EMA(BarsArray[2], 15).Plots[0].Pen.Color = Color.Blue;
}
protected override void OnBarUpdate()
{
}
Thanks,
|