bobhobe
New member
Here is a moving average that identifies breakout points.
The accuracy of the breakout/breakdown points are not that good.
Any suggestions to improve accuracy would be appreciated.
The accuracy of the breakout/breakdown points are not that good.
Any suggestions to improve accuracy would be appreciated.
Code:
declare lower;
input length = 15;
input multiplier = 2.0;
def price = close;
def average = MovingAverage(AverageType.SIMPLE, price, length);
def upperBand = average + multiplier * StDev(price, length);
def lowerBand = average - multiplier * StDev(price, length);
def isBullishBreakout = close > upperBand;
def isBearishBreakout = close < lowerBand;
plot MA = average;
plot BullishBreakoutPoints = if isBullishBreakout then close else Double.NaN;
plot BearishBreakoutPoints = if isBearishBreakout then close else Double.NaN;
BullishBreakoutPoints.SetPaintingStrategy(PaintingStrategy.POINTS);
BullishBreakoutPoints.SetLineWeight(2);
BullishBreakoutPoints.SetDefaultColor(Color.GREEN);
BearishBreakoutPoints.SetPaintingStrategy(PaintingStrategy.POINTS);
BearishBreakoutPoints.SetLineWeight(2);
BearishBreakoutPoints.SetDefaultColor(Color.RED);
MA.SetDefaultColor(Color.BLUE);
Last edited by a moderator: