Getting “Value never assgined to” on my variables vSignalCandleClose and vSignalCandleStop. What am I doing wrong?
#—–MyIndicator–
def vSignalCandleClose;
def vSignalCandleStop;
def vEMA = MovingAverage(AverageType.EXPONENTIAL, close, 20);
def closeAboveEMA = close[1] < vEMA[1] and close > vEMA;
def closeBelowEMA = close[1] > vEMA[1] and close < vEMA;
#
if (closeAboveEMA ) {
vSignalCandleStop = low – 1;
vSignalCandleClose = close;
} else {
#
}
if (closeBelowEMA) {
vSignalCandleStop = high + 1;
vSignalCandleClose = close;
} else {
#
}
#
Alert(closeAboveEMA, “NQ – Close Crossed Above EMA – BUY”, Alert.BAR, Sound.Chimes);
Alert(closeBelowEMA, “NQ – Close Crossed Below EMA – SELL”, Alert.BAR, Sound.Ding);
AddLabel (yes, “Close of Signal Candle” + (vSignalCandleClose) );
AddLabel (yes, “SuggestedStop” + (vSignalCandleStop) );
Like this:
Like Loading...