works great!! However I'm trying to add a second condition to it with a CrossAbove an EMA(period) indicator & I can't resolve the 'Unassigned Local variable' Error for the variable 'trail'. The standard ATR script runs just fine. What am I doing wrong?
[CODE]
{
#region Variables
privateint period = 20;
privatedouble multi = 3.5;
privatedouble trail = 1;//I tride to assign the variable here.
#endregion
///<summary>
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar < 1)
return;
double trail;
double loss = ATR(Input, Period)[0] * Multi;
if (Close[0] > Value[1] && Close[1] > Value[1])
trail = Math.Max(Value[1], Close[0] - loss);
***if (CrossAbove(trail, EMA(period), 1)); //This is where I get the ERROR saying "Unassigned Local variable 'trail'
Comment