liminal-rider
New member
Hi forum, I need help with the below custom quote formula, particularly the add label function, instead of a word in the label field it produces a digit(i.e.91.62).
What am I missing?
#Combined Script
#TOS MACD
#Hull Concavity by @mashume
input FAST = 9;
input SLOW = 18;
input Length1 = 9;
Input price = close;
input Length2 = 18;
input Lookback = 2;
#Constants
def a = 2 / (1 + FAST);
def b = 1 - a;
def c = 2 / (1 + SLOW);
def d = 1 - c;
def e = 2 / (1 + Length1);
def f = 1 - e;
rec FASTMAQ = (close[1] * a) + (FASTMAQ[1] * b);
rec SLOWMAQ = (close[1] * c) + (SLOWMAQ[1] * d);
def MACD = FastMAQ - SLOWMAQ;
rec Signal = (MACD * e) + (Signal[1] * f);
plot Crossprice = ((Signal * f) + (FASTMAQ * b * e) - (SLOWMAQ * d * e) -
(FASTMAQ * b) + (SLOWMAQ * d)) / (a - c - (a * e) + (c * e));
plot HMA = MovingAverage(AverageType.HULL, price, length2)[-lookback];
def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;
def next_bar = HMA[1] + delta_per_bar;
def concavity = if HMA > next_bar then 1 else -1;
plot MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
plot MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.Nan;
def trendup = if MA_Min and close > crossprice then 1 else 0;
def trenddown = if MA_Max and close < crossprice then 1 else 0;
def distribution = if !trendup and !trenddown then 1 else 0;
AddLabel(trendup, "TrendUp", color.black);
AddLabel(TrendDown, "TrendDown", color.yellow);
AddLabel(!TrendUp and !TrendDown, "Neutral", color.black);
AssignBackgroundColor(if TrendUp then color.ORANGE else if TrendDown then color.BLUE else color.light_gray);
What am I missing?
#Combined Script
#TOS MACD
#Hull Concavity by @mashume
input FAST = 9;
input SLOW = 18;
input Length1 = 9;
Input price = close;
input Length2 = 18;
input Lookback = 2;
#Constants
def a = 2 / (1 + FAST);
def b = 1 - a;
def c = 2 / (1 + SLOW);
def d = 1 - c;
def e = 2 / (1 + Length1);
def f = 1 - e;
rec FASTMAQ = (close[1] * a) + (FASTMAQ[1] * b);
rec SLOWMAQ = (close[1] * c) + (SLOWMAQ[1] * d);
def MACD = FastMAQ - SLOWMAQ;
rec Signal = (MACD * e) + (Signal[1] * f);
plot Crossprice = ((Signal * f) + (FASTMAQ * b * e) - (SLOWMAQ * d * e) -
(FASTMAQ * b) + (SLOWMAQ * d)) / (a - c - (a * e) + (c * e));
plot HMA = MovingAverage(AverageType.HULL, price, length2)[-lookback];
def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;
def next_bar = HMA[1] + delta_per_bar;
def concavity = if HMA > next_bar then 1 else -1;
plot MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
plot MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.Nan;
def trendup = if MA_Min and close > crossprice then 1 else 0;
def trenddown = if MA_Max and close < crossprice then 1 else 0;
def distribution = if !trendup and !trenddown then 1 else 0;
AddLabel(trendup, "TrendUp", color.black);
AddLabel(TrendDown, "TrendDown", color.yellow);
AddLabel(!TrendUp and !TrendDown, "Neutral", color.black);
AssignBackgroundColor(if TrendUp then color.ORANGE else if TrendDown then color.BLUE else color.light_gray);
Last edited by a moderator: