Assert ( Any message , boolean condition , Any message );
Default values:
message: "assert failed"
message: "assert failed"
Description
Throws a runtime error message in case the specified condition is false. The error message can be viewed by clicking Exclamation indicator in the top left corner of the chart.
Input parameters
Parameter | Default value | Description |
---|---|---|
condition | - | Defines condition upon which the error message is displayed. |
message | "assert failed" | Defines the text of error message. |
Example
input percent = 5.0;
Assert(percent > 0.0, "percent must be positive");
plot UpperBand = (1 + percent / 100 ) * close ;
plot LowerBand = (1 - percent / 100 ) * close ;
If "percent" input parameter is not a positive value, study plots are not displayed and Exclamation indicator appears.