Hi All,
I appreciate your assistance in advance. When I need to add something I usually comb the site and the scripts available. But, I seem to not find the solution for my issue.
I am getting the following when I try to use the following def with the script above. The above script works, but the additional def throws me an error. What am I doing wrong or how can fix it? Thank you in advance. @cabe1332
def MoMoText == if MoMoInd >= 0 then "Mo UP" else "Mo DN";
Error: Invalid statement: def at 44:1
def MoMoText = if MoMoInd > 0 then "Mo UP" else "Mo DN";
Error:
Incompatible parameter: "Mo UP" at 44:5
Incompatible parameter: "Mo DN" at 44:5
Expected double at 44:5
I appreciate your assistance in advance. When I need to add something I usually comb the site and the scripts available. But, I seem to not find the solution for my issue.
Code:
input lengthmo = 5;
def c = close;
def Momentum = c - c[lengthmo];
def NegMomentum = c - c[lengthmo];;
def mopos = if Momentum >= 0 then 3 else 2;
def moneg = if Momentum < 0 then 3 else 2;
def MoMo = if Momentum >= 0 then momentum else if Momentum < 0 then NegMomentum else double.nan;
def MoMoInd = round(MoMo)* 100;
I am getting the following when I try to use the following def with the script above. The above script works, but the additional def throws me an error. What am I doing wrong or how can fix it? Thank you in advance. @cabe1332
def MoMoText == if MoMoInd >= 0 then "Mo UP" else "Mo DN";
Error: Invalid statement: def at 44:1
def MoMoText = if MoMoInd > 0 then "Mo UP" else "Mo DN";
Error:
Incompatible parameter: "Mo UP" at 44:5
Incompatible parameter: "Mo DN" at 44:5
Expected double at 44:5