Handlers are the backbone of your trading strategy. They respond to specific events, like price updates or position changes, and help you automate your trading decisions. In this guide, we’ll break down each handler in detail, explain how to build the State and Update portions, and provide three examples for each handler to show how they can be used in different trading strategies.

Sitemap _ BT - Frame 4.jpg


Summary of Handlers

Handler When It Runs Example Use Case
On Price Update New price update (candle or trade) Check if the price reaches a certain level.
On Update Periodically (e.g., every few seconds) Monitor open positions or update indicators.
On Update Long Long position (buy trade) is updated Adjust stop-loss or take profit for buy trades.
On Update Short Short position (sell trade) is updated Adjust stop-loss or take profit for sell trades.
On Update Closing Position is being closed Log final profit or loss before closing.
On Position Open New position is opened Log entry price or set up stop-loss.
On Position Update Open position is updated Monitor and manage open trades.
On Position Close Position is closed Calculate and log profit or loss.

By understanding these handlers, you can build a trading strategy that responds to market events automatically. If you have any questions or need further clarification, feel free to DM us via chat!

1. On Price Update

2. On Update

3. On Update Long

4. On Update Short

5. On Update Closing

6. On Position Open

7. On Position Update

8. On Position Close