I'm trying to print an arrow when the SMA(x) crosses above or below an instrument. I thought that the SMA function would do that but when I edit the SMA built in indicator I get the following code:
if (CurrentBar == 0)
Value.Set(Input[0]);
else
{
double last = Value[1] * Math.Min(CurrentBar, Period);
if (CurrentBar >= Period)
Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
else
Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
}
All I want to do is something like this:
if (CrossAbove(SMA(Period), Close[0], 1))
{
DrawArrowUp("UP" + CurrentBar, true, 0, Low[0]- (TickSize*20), Color.Red);
}
if (CrossBelow(SMA(Period), Close[0], 1))
{
DrawArrowDown("DOWN" + CurrentBar, true, 0, High[0] + (TickSize*20), Color.Orange );
}
But when I try to assign a value to my condition I get something like cannot convert implicit Ninja series to double.
Help?
Thanks!
Tex
Comment