Closed pattty847 closed 1 year ago
looks like de
can be 0 in your script
dividing by 0 lead to NaN (not a number) which doesnt work on the chart
ci = (src - esa) / (0.015 * (de || 1))
scripting is very raw... and does not have much verifications to prevent too much performance impact
so to debug the script you can use your browser dev tool, and type "debugger" in the script code although variables will have different names, it can help understanding the why it's not printing anything :)
wrap it in a condition like if (!src) debugger
at the very beginning of the script to ensure the breakpoint will be active before the first bar is rendered (click in and out the code box to re render all bars)
Bless Tucsky. Thanks for your help again.
Question: So, if de
evaluates to 0 it will use 1 instead? Will that effect the output anyway?
If anyone wants the script I had two variables swapped. The corrected version is:
src = (($price.high + $price.low + $price.close) / 3)
esa = ema(src, 15)
de = ema(Math.abs(src - esa), 15)
ci = (src - esa) / (0.015 * (de || 1))
wt1 = ema(ci, 26)
wt2 = sma(wt1, e)
cloudarea(0, wt1, positiveColor=options.bullColor, negativeColor=options.bearColor, title = 'Wavetrend', linewidth=1)
cloudarea(wt2, wt1, positiveColor=options.bullColor, negativeColor=options.bearColor, linewidth=1)
Hello again,
I'm just trying to make a script and I seem to be stuck on the last two wt1/wt2.
It seems that the wt1, and wt2 do not do anything. I have ran
console.log
onci, de, esa, src
and they all have values butwt1/wt2
are labeled NaN. I get no errors after saving either.Maybe you should also create a Discord too, Tucsky! I'm sure tons of ppl would join.