here is the simple code that i wrote:
To make the chart or signal clean, can someone help me plot the first crossover only? like the one encircled on the chart.
Thank you
Code:
input length = 21;
input averageType = AverageType.WILDERS;
def ATR = MovingAverage(averageType, TrueRange(high-low, (high-close[1]), (low-close[1])), length);
def bull = movavgExponential(close,21) + atr;
def bear = movavgExponential(close,21) - atr;
plot bullcross = crosses(close,bull, crossingdirection.above);
bullcross.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot bearcross = crosses(close,bear,crossingdirection.below);
bearcross.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
To make the chart or signal clean, can someone help me plot the first crossover only? like the one encircled on the chart.
Thank you