blocks
Three ways to write a when body: indent, then, or curly braces.
Reference/Language basics/Language
when cond
buy
when cond then buy
when cond { buy }Indent is the usual Dovee style. then is a one-liner. Braces { } work if you prefer C-style blocks. Mix is allowed.
Return value
—
For developers
- C-style { } blocks, same idea as MQL5/C++ braces.
Example
when ema(9) crosses above ema(21)
buy
arrow up "Buy"
when rsi(14) is below 30 then buy
when rsi(14) is above 70 {
exit
alert "Overbought"
}