I am working on a strategy that enters an order as the rangecounter goes below a certain value before the next bar. I created this in strategyCreation Wizard, but no orders are placed. I have it set to work intrabar,and that still does not solve the problem. I then tried using a current high minus the current bar low, but still no trades where triggered. I am attaching a copy of both codes for review. Thanks for any help in fixing this in advance.
Code with Range counter
" CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (RangeCounter(true)[0] < RangeThreshold)
{
EnterLong(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int RangeThreshold
{
get { return rangeThreshold; }
set { rangeThreshold = Math.Max(1, value); }
}
[Description("")]
[Category("Parameters")]
public int Profit
{
get { return profit; }
set { profit = Math.Max(1, value); }
}
[Description("")]
[Category("Parameters")]
public int Loss
{
get { return loss; }
set { loss = Math.Max(1, value); }
}
#endregion
}
}"
Code using High minus Low
"
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, Profit);
SetStopLoss("", CalculationMode.Ticks, Loss, false);
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if ((High[0] - Low[0])> rangeThreshold)
{
EnterLong(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int RangeThreshold
{
get { return rangeThreshold; }
set { rangeThreshold = Math.Max(1, value); }
}
[Description("")]
[Category("Parameters")]
public int Profit
{
get { return profit; }
set { profit = Math.Max(1, value); }
}
[Description("")]
[Category("Parameters")]
public int Loss
{
get { return loss; }
set { loss = Math.Max(1, value); }
}
#endregion
}
}"

Comment