Is it possible to use a Variable as an Indicator input? How would I do this if so?
For example, I tried using the code below to set Variable1 as the input for an SMA indicator, but got an error message when I tried to compile it.
What would I do differently?
protected override void OnBarUpdate()
{
if (Position.MarketPosition == MarketPosition.Long)
{
Variable1 = Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
}
if (SMA(Variable1, 7)[0] > SMA(Variable1, 14)[0])
{
ExitLong("", "");
}
}

Comment