Skip to main content

I want to make an app that alerts when the 50 MA crosses the 200 MA. Can I do that with your api?

How to make an alert when an indicator value crosses a different indicator value?

Yes, this is exactly the kind of thing TAAPI.IO is great for. Use a bulk query to fetch both moving averages in one request, run it periodically (every hour, every minute, or every few seconds) and compare the values. When the 50 MA moves from below the 200 MA to above it (or the other way around), that's your crossover, and your own logic decides what happens next.

POST this JSON to https://v2.taapi.io/bulk, with your API key in the Authorization: Bearer YOUR_API_KEY header and Content-Type: application/json:

{
"constructs": [
{
"id": "btc_1h",
"exchange": "binance",
"symbol": "BTCUSDT",
"timeframe": "1h",
"indicators": [
{ "id": "ma_50", "indicator": "ma", "period": 50 },
{ "id": "ma_200", "indicator": "ma", "period": 200 }
]
}
]
}

Response

{
"btc_1h": {
"ma_50": { "value": [77876.56], "timestamp": [1793653200] },
"ma_200": { "value": [79136.96], "timestamp": [1793653200] }
}
}

Tips

  • Add "results": 2 to each indicator to get the previous and the current value in one call (oldest first). A crossover happened if the order of the two MAs is different between the two candles.

  • You can add up to 20 indicators to the same construct. Depending on your plan, you can also add more constructs (other symbols or timeframes) to the same request: 3 on Pro and 10 on Expert.

  • For live updates without polling, use WebSocket streaming (available on the 1m, 5m, 15m and 1h timeframes).

Did this answer your question?