I used the Sample Data Series as a guide, but yet it doesn't work (it takes just one trade, regardless of the backtest period):
protectedoverridevoid Initialize()
{
Add(PeriodType.Minute, 5);
primarySeries = new DataSeries(this);
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (secondarySeries == null)
{
secondarySeries = new DataSeries(RSI(BarsArray[1], 2, 0));
}
// Executed on primary bar updates only
if (BarsInProgress == 0)
{
primarySeries.Set(RSI(2, 0)[0]);
}
// Executed on secondary bar updates only
if (BarsInProgress == 1)
{
secondarySeries.Set(RSI(2, 0)[0]);
}
if (primarySeries[0] > 0 && secondarySeries[0] > 0 && secondarySeries[0] > primarySeries[0])
{
EnterLong(DefaultQuantity, "");
ExitShort("", "");
}
if (primarySeries[0] < 0 && secondarySeries[0] < 0 && secondarySeries[0] < primarySeries[0])
{
EnterShort(DefaultQuantity, "");
ExitLong("", "");
}
}
I don't get any error message in the Log.
Thank you
Comment