The trigger mode defines the frequency and timing of the khHandlebar function calls (the strategy's "heartbeat").
Tick Trigger
Executes whenever market transaction data arrives (in MiniQMT, this is a snapshot every 3 seconds).
- Pros: Maximum flexibility for adding custom filtering logic.
- Cons: High data volume and slower backtesting speeds due to the large amount of data required.
K-Line Trigger
Executes based on fixed time intervals. In the KHQuant backtesting system, supported periods are 1-minute and 5-minute K-lines.
- Pros: Low resource consumption and fast backtesting. Ideal for trend-following and technical analysis strategies.
- Note: In live trading, even if subscribing to 1m/5m K-lines, the data feed typically pushes updates every 3 seconds. In backtesting, execution occurs strictly at the end of the K-line period.
Custom Time Trigger
Allows you to specify exact timestamps for execution. Ideal for scheduled trading (e.g., opening auction or market close strategies) or non-standard intervals (e.g., every 10 minutes).
- Important: Unlike Tick or K-line triggers, a Custom Time trigger does not automatically pass data to the
khHandlebar function. You must manually call data acquisition interfaces (e.g., get_market_data) inside your function. - Smart Adaptation:
- If all timestamps are on the exact minute (e.g., 09:30:00), the system uses 1-minute K-line data.
- If timestamps include non-minute seconds (e.g., 09:30:15), the system switches to underlying Tick data for precision.
- Precision Tip: For stability in MiniQMT, all custom timestamps should be set to a multiple of 3 seconds.