I'm using a number of indicators combined and testing best settings for buy or sell. I am also trying to build in variations that can be tested when optimizing rather than change one at a time manually to find the best setting.
Similar to this example I wish to test both "<" and ">" options when optimizing however the error is MASDS1 does not exist in current context.
[Parameter("Greater - Less 1", DefaultValue = false, Group = "> or <")]
public bool GL1 { get; set; }
protected override void OnBar()
{
var Volumn = Math.Floor((Account.Equity - (Account.Balance * 0.9)) * (Percentage / 1000));
var VolumeInUnits = Symbol.NormalizeVolumeInUnits(Volumn, RoundingMode.ToNearest);
if (MCDS1 && _macd.Histogram.LastValue > 0)
{
ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label, StopLoss, TakeProfit);
}
protected override void OnTick()
{
if (GL1)
{
var MCDS1 = (_macd2.MACD.LastValue > _macd2.Signal.LastValue);
}
else
{
var MCDS1 = (_macd2.MACD.LastValue < _macd2.Signal.LastValue);
}
}