Simple example
The implementation of alerts and rule-based trading is not yet complete. This documentation describes the planned and partially implemented functionality.
Work in Progress - Target version V0.38.0
In the dialog Strategy definition, replace the content of the YAML editor with the following configuration and save it with Apply.
What the settings do
The strategy only buys (long_only). It compares every daily close with the close 20 observations, roughly four trading weeks, earlier. If the price is at least 8% lower, it proposes a purchase of 2% of net equity.
An open position is sold entirely as soon as it is 6% above the weighted average entry price. If it falls 8% below that price, the stop-loss also sells it entirely. An additional loss condition under trigger is not needed here, because the fixed stop alone decides the exit.
After a purchase or sale the strategy waits five calendar days before it proposes a new entry. Within 30 days at most four recorded transactions of this instrument are allowed. The risk limits act as a safety net: the position may make up at most 5% of net equity, and it is closed immediately on a loss of 15% or when a limit is breached.
A run in figures
Net equity is 100,000, and the security traded at 100 twenty observations ago.
- The price closes at 92, which is 8% lower. The strategy proposes a purchase of 2,000, roughly 21.7 units.
- You record the purchase at 92 and select
simple_dipin the Strategy assignment. The average entry price is now 92. - If the price rises to 97.52 or higher (92 plus 6%), the strategy proposes selling the entire position.
- If the price instead falls to 84.64 or lower (92 minus 8%), the stop-loss proposes selling the entire position.
- Once the sale is recorded, the five-day cooldown begins; afterwards a new entry is possible again.
The 15% limit is not reached in this run, because the stop at 8% fires earlier. It only takes effect when a single price jump crosses both thresholds at once, and the result is then the same: the entire position is sold.
Extending it
The example with partial profits shows the options left out here. Every setting is described under Effective settings.