detect_cross
Detect crossover and crossunder events between two indicators or price series. Returns the latest values, current relation, whether a cross occurred on the last bar, and bars since the last cross.
Instructions
Pine-style crossover analysis (ta.crossover/ta.crossunder).
series_a and series_b are each an indicator spec (ema:20,
ta.sma(50)), a price source (close, hl2, …) or a numeric
constant ("30"). Example: a golden cross is
series_a="ema:50", series_b="ema:200". Returns the latest values,
their relation, whether a cross happened on the last bar, and how many
bars since the last cross.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"symbol": "<symbol>",
"series_a": "<series_a>",
"series_b": "<series_b>"
},
"name": "detect_cross"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| symbol | Yes | ||
| exchange | No | ||
| series_a | Yes | ||
| series_b | Yes | ||
| timeframe | No | 1h |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||