I'm in trouble with a new strategy In programming. This is a first part of it:
protected override void Initialize()
{
Add(PeriodType.Range,2);
Add(PeriodType.Range,1);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 0)
{
if (RSI(12, 3)[i]>RSI(12, 3).Avg[i] && MACD(12, 26, 9)[i] > MACD(12, 26, 9).Avg[i] &&
RSI(BarsArray[1],12, 3)[i]>RSI(BarsArray[1],12, 3).Avg[i] && MACD(BarsArray[1], 12, 26, 9)[i] > MACD(BarsArray[1],12, 26, 9).Avg[i] &&
RSI(BarsArray[2],12, 3)[i]>RSI(BarsArray[2],12, 3).Avg[i] && MACD(BarsArray[2], 12, 26, 9)[i] > MACD(BarsArray[2],12, 26, 9).Avg[i]
)
{
myEntryOrderLONG = EnterLongLimit(1, true, 1,"", "");
}
}
I noticed after a debug session that all RSI and MACD indicators (RSI(BarsArray[1],12, 3) and MACD(BarsArray[1], 12, 26, 9)) for the secondary time aren't completely wrong.
What's wrong in my programm?
Thank for your help.
Michel

Comment