I am working with a pre-existing strategy (a divergence strategy that I dl'ed from here that I have been tweaking for the last year or so).
I'm trying to add two conditions to it. So I created, using the wizard, code that has two conditions, regarding ADX and Linear Regression slope. When I transferred it to code, it looks like this:
// Condition set 1
if (ADX(60)[0] > 0
&& LinRegSlope(60)[0] > 0)
{
}
So anyway, here is that above code smashed into my existing code. /// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1 - Positive Divergence
if (((Divergence(ergodicfastPeriod, "ergodic", positiveD, 1,ergodicslowPeriod).Plot0[0] == 2 && Divergence(cciPeriod, "cci", positiveD, 9,26).Plot0[0] == 2) ||
(Divergence(ergodicfastPeriod, "ergodic", positiveD, 1,ergodicslowPeriod).Plot0[0] == 2 && Divergence(macdfastPeriod, "macd", positiveD, macdsignalPeriod,macdslowPeriod).Plot0[0] == 2) ||
(Divergence(cciPeriod, "cci", positiveD, 9,26).Plot0[0] == 2 && Divergence(macdfastPeriod, "macd", positiveD, macdsignalPeriod,macdslowPeriod).Plot0[0] == 2)) &&
Position.MarketPosition == MarketPosition.Flat)
(LinRegSlope(60)[0] > 0
&& ADX(60)[0] > 0);
{
EnterLong(1, "Long");
justEntered = true;
}
Any advice to make this strategy to compile correctly?

Comment