Category
General-Purpose Functions
Description
Stop script execution and log the details of a strategy formula's evaluation when a condition is met
Syntax
DebugEval(condition, formula)
Parameters
condition - when to stop execution and evaluate the formula
formula - the formula to evaluate
Notes
DebugEval is meant to be wrapped around a strategy formula when necessary to learn the details of how it is being calculated in the context of a specific point in a running test.
For example say you have a complex Quantity formula such as:
.png)
(from the clenow_stocks_on_move_dynamic.rts example script)
You want to see exactly how it is being calculated for AAPL on 2024-06-21:
.png)
Run the test and it will run as normal until coming to that symbol and date, then will:
•turn on the same mechanism used for "Show Evaluation" option in the Debug Panel
•evaluate the formula, causing full evaluation details to be written to a log window
•abort the test
At this point you can examine the log output and also use the debug panel as needed to explore data values in memory, open positions, etc.
Note that DebugEval cannot be used in Data or Scan formulas. This is because those are calculated in separate threads and this function is not reentrant. It is intended for use in Strategy formulas only.
|