I added the different time frames by using the Add()
Add (PeriodType.Minute, 5);
Add (PeriodType.Minute, 15);
Add (PeriodType.Minute, 60); etc
In the OnBarUpdate section
if (BarsInProgress == 0) // process only when the primary bar is updated
{
in this section I determine the SMA for each time frame using
Slope5 = SMA(BarsArray[1},18); // sma for the 5 minute
Slope15 = SMA(BarsArray[2},18); // sma for the 15 minute
Slope60 = SMA(BarsArray[3},18); // sma for the 60 minute
....
...
}
When I run this opening the chart in the 60 Minute period type it works fine. But when I try to load it in a lower time period, such as the 5 Minute, it doesn't work and give a message something like index not in range. I understand that the period type that you open a chart in becomes the primary and is index = 0 but if I open a chart in the lower time frame, how to I determine the SMA for the higher time frames.
Second part, say my primary instrument is the ES 06-11. In the same indicator above, how would I bring in and reference the ES ##-## (continuous contract) instrument to determine a moving average?
Thanks for any hints or help that you can provide.
Regards,
Comment