Parameter values are kept and that's by design, was: Unexpected result

The results are the same under both v6.28 and v6.40,
The expected result is limit = 500 before z1 = zzz( Close, limit );, but it is always 7.

My full code is as below (for your convenience of testing)

function zzz( price, limit )
    ans = 0;
    ans[0] = price[0];
    ans = ValueWhen( ans != 0, ans );
    return ans;
limit = Param( "zig1", 500, 40, 1000, 5 );
z1 = zzz( Close, limit );
Plot( z1, "z1", colorAqua );

You apparently have some left-over zig1 parameter from previous formula. Keep in mind that parameter values are cached and kept between executions. The value left from old formula is NOT reset to default and/or min/max between executions. It is kept. Press "Reset All" button in the parameters window to reset back to defaults.

As you say, I should press [Reset All] on the Parameter window,
then stop debugging, then debugging again, but the limit still be 7,
I've also tried to delete the *.dbg, but the limit still be 7.

And there is another thing I've noticed,
that is the Parameter window cannot resize the column name,
so even 4 characters "zig1" cannot be shown completely.

Press [Reset All] in the Parameter window before you start the Debugger.

Note: Chart parameters are NOT used by the Debugger. Debugger reads parameters set in the Analysis window.

1 Like

As @TrendSurfer said, you have to use ANALYSIS window and set parameters there because Editor uses Parameters from Analysis window.

You have to understand that parameters are linked to ChartID. So each chart can have INDEPENDENT parameters even if they are named the same. Charts have ChartID > 0. The Analysis on the other hand has ChartID == 0. And that same is shared with Editor.


Why don't consider adding a "Parameters" tool button
with two options (Chart's Parameters; Debugger's Parameters)
on the toolbar of Formula editor (to reduce the confusion of users)?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.