#wizard input: length1
#wizard text: -period
#wizard input: averageType1
#wizard text: crosses
#wizard input: crossingType
#wizard input: length2
#wizard text: -period
#wizard input: averageType2
#wizard text: Price:
#wizard input: price
input price = close;
input length1 = 3;
input length2 = 22;
input averageType1 = AverageType.EXPONENTIAL;
input averageType2 = AverageType.EXPONENTIAL;
def avg1 = MovingAverage(averageType1, price, length1);
def avg2 = MovingAverage(averageType2, price, length2);
def avgDiff1 = avg1 - avg2;
def avgDiff2 = avg2 - avg1;
input ATRPeriod = 12;
input ATRMultipler = 2.0;
input averageType = AverageType.WILDERS;
def atr = MovingAverage(averageType, TrueRange(high, close, low), ATRPeriod);
plot DownSignal = avgDiff1 > atr * ATRMultipler;
plot upSignal = avgDiff2 > atr * ATRMultipler;
plot a1 = avgDiff1 * 1.0;
a1.SetDefaultColor(GetColor(8));
plot Arr = atr;
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);