kjagadevan
New member
Bullish Buy signal when a the doji followed by hammer and piercing pattern forming a bullish ascending triangle. But Getting the errors.
No such variable: doji at 28:11
No such variable: doji at 31:16
No such variable: Hammer at 35:11
No such variable: Hammer at 38:18
No such variable: piercing at 42:11
No such variable: piercing at 45:20
No such variable: doji at 28:11
No such variable: doji at 31:16
No such variable: Hammer at 35:11
No such variable: Hammer at 38:18
No such variable: piercing at 42:11
No such variable: piercing at 45:20
CODE AS FOLLOWS:
# Bullish Buy Signal
# Doji followed by Hammer and Piercing Pattern
# Bullish Ascending Triangle
input length = 9;
input dojiBodySize = 0.01;
input hammerTailSize = 0.03;
input piercingBodySize = 0.01;
input trendLength = 9;
input trendADXThreshold = 25;
def open = open(period = "DAY");
def close = close(period = "DAY");
def high = high(period = "DAY");
def low = low(period = "DAY");
def dojiBody = AbsValue(open - close) <= dojiBodySize * high;
def dojiHigh = high - open > close - low;
def dojiLow = low - open < close - high;
def isDoji = dojiBody and dojiHigh and dojiLow;
def isHammer = (close - low) / (high - low) > 2 * hammerTailSize and (high - close) / (high - low) < 1 - 2 * hammerTailSize;
def isPiercing = close > open and (open - low) / (high - low) > 2 * piercingBodySize and (high - close) / (high - low) > 2 * piercingBodySize;
def lastDoji;
if (IsNaN(doji[1])) {
lastDoji = isDoji;
} else {
lastDoji = doji[1];
}
def lastHammer;
if (IsNaN(Hammer[1])) {
lastHammer = isHammer;
} else {
lastHammer = Hammer[1];
}
def lastPiercing;
if (IsNaN(piercing[1])) {
lastPiercing = isPiercing;
} else {
lastPiercing = piercing[1];
}
plot doji = if isDoji then 1 else 0;
plot hammer = if isHammer then 1 else 0;
plot piercing = if isPiercing then 1 else 0;
def trendUp = if (ADX(length) > trendADXThreshold) then 1 else 0;
def buySignal = lastDoji and lastHammer and lastPiercing and trendUp;
plot buyArrow = if buySignal then high else Double.NAN;
buyArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buyArrow.SetLineWeight(3);
buyArrow.SetDefaultColor(Color.GREEN);
No such variable: doji at 28:11
No such variable: doji at 31:16
No such variable: Hammer at 35:11
No such variable: Hammer at 38:18
No such variable: piercing at 42:11
No such variable: piercing at 45:20
No such variable: doji at 28:11
No such variable: doji at 31:16
No such variable: Hammer at 35:11
No such variable: Hammer at 38:18
No such variable: piercing at 42:11
No such variable: piercing at 45:20
CODE AS FOLLOWS:
# Bullish Buy Signal
# Doji followed by Hammer and Piercing Pattern
# Bullish Ascending Triangle
input length = 9;
input dojiBodySize = 0.01;
input hammerTailSize = 0.03;
input piercingBodySize = 0.01;
input trendLength = 9;
input trendADXThreshold = 25;
def open = open(period = "DAY");
def close = close(period = "DAY");
def high = high(period = "DAY");
def low = low(period = "DAY");
def dojiBody = AbsValue(open - close) <= dojiBodySize * high;
def dojiHigh = high - open > close - low;
def dojiLow = low - open < close - high;
def isDoji = dojiBody and dojiHigh and dojiLow;
def isHammer = (close - low) / (high - low) > 2 * hammerTailSize and (high - close) / (high - low) < 1 - 2 * hammerTailSize;
def isPiercing = close > open and (open - low) / (high - low) > 2 * piercingBodySize and (high - close) / (high - low) > 2 * piercingBodySize;
def lastDoji;
if (IsNaN(doji[1])) {
lastDoji = isDoji;
} else {
lastDoji = doji[1];
}
def lastHammer;
if (IsNaN(Hammer[1])) {
lastHammer = isHammer;
} else {
lastHammer = Hammer[1];
}
def lastPiercing;
if (IsNaN(piercing[1])) {
lastPiercing = isPiercing;
} else {
lastPiercing = piercing[1];
}
plot doji = if isDoji then 1 else 0;
plot hammer = if isHammer then 1 else 0;
plot piercing = if isPiercing then 1 else 0;
def trendUp = if (ADX(length) > trendADXThreshold) then 1 else 0;
def buySignal = lastDoji and lastHammer and lastPiercing and trendUp;
plot buyArrow = if buySignal then high else Double.NAN;
buyArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buyArrow.SetLineWeight(3);
buyArrow.SetDefaultColor(Color.GREEN);