Basically I want to add different time frame in my automated trading strategy along with some indicators for those time frames ( SMAs in this case)
I did a backtesting on this strategy, it seems to give some crazy results.
protected override void Initialize() { // Trading frame Add(PeriodType.Tick, 144); // BarsArray[1] // Add a 5 minute Bars object to the strategy Add(PeriodType.Minute, 3); // BarsArray[2] // Add a 15 minute Bars object to the strategy Add(PeriodType.Minute, 10); // BarsArray[3] // Add a 30 minute bar object to the strategy Add(PeriodType.Minute, 30); // BarsArray[4] // Note: Bars are added to the BarsArray and can be accessed via an index value // E.G. BarsArray[1] ---> Accesses the 5 minute Bars object added above // Add simple moving averages to the chart for display // This only displays the SMA's for the primary Bars object on the chart Add(SMA(BarsArray[1], 15)); Add(SMA(BarsArray[1], 89)); Add(SMA(BarsArray[2], 20)); Add(Stochastics(BarsArray[2],7,14,3)); Add(SMA(BarsArray[3], 20)); Add(Stochastics(BarsArray[3],7,14,3)); CalculateOnBarClose = false; }
Comment