Add comments to a strategy
A Strategy Definition uses JSON, which does not support comments. You can still document your reasoning inside fields that accept Lua expressions.
Use -- inside the quoted expression to begin a Lua comment. For example:
"Qty": "-1 -- Sell one contract"
The expression evaluates to -1; the text after -- is a comment.
Example: explain a leg's settings
In the AI Editor, add comments to expression fields such as Qty and Delta:
"Legs": [
{
"Name": "short_call",
"Qty": "-1 -- Sell one contract",
"ExpirationName": "160dte",
"StrikeSelector": {
"Min": 5,
"Max": 15,
"Delta": "10 -- Target a 10-delta call"
},
"OptionType": "Call"
}
]
This is a fragment for the Structure section. Keep the other required fields, including the expiration named 160dte.
Keep the JSON valid
- Put the comment inside the quotation marks of a Lua expression.
- Use comments only in fields that accept expressions. Fields such as
Name,ExpirationName, andOptionTypeare text values, so--is not treated as a comment there. - Do not add
//or/* ... */comments between JSON fields.
Select Validate in the editor after making changes. See Create and run a backtest for the full workflow, or the Lua comment syntax reference for more detail.