Introducing: Conditional Trigger & Order APIs on DhanHQ

Hello Traders,

At Dhan, we’ve always believed in building tools that don’t just serve traders, they transform how trading gets done. We have always been and will continue to be a technology company first and this is the reason why we have kept innovation on front. This reflects in all the trading tools that you interact with daily as part of the Dhan ecosystem.

As a result of our tech-first approach, Dhan launched its Trading APIs via DhanHQ very early in its journey. We introduced these trading APIs with one vision - to deliver a developer-first experience curated exclusively for retail API and algo traders in India.

Our data & trading APIs are built on the same core infrastructure that powers all Dhan trading platforms, executes orders via DEXT and streams the same data that you see on top of charts. We started with Trading APIs and then over time, we have increased our API offerings to include all the data and execution capabilities that only institutions had access to - whether that be Full Market Depth on APIs, Expired Options Data, Super Orders or the seamless execution that you experience backed by DEXT, our proprietary core trading engine.

Until now, retail traders had to go through hundreds of lines of code just to get one trading strategy / algo ready for trading in the markets. This includes fetching data from broker websockets and APIs, defining patterns and calculating indicators in their code and then generating signals. This entire workflow takes up a lot of time for an API or tech developer, and they often run into indicator miscalculations and errors. At the same time, systems lacked reliability and the opportunity to cover the breadth of analysis, as each indicator-based signal required additional development time.

We are eliminating this entire workflow today. Market Alerts on Dhan have been widely used by all our users, whether that be directly on charts or while finding stocks on the app. We have also worked to bring technical alerts to you, which give you the ability to set conditions comparing an indicator with another indicator or with your own set levels. We are bringing the same capability and more to you now on APIs via Conditional Triggers.

Introducing: Conditional Trigger APIs on DhanHQ

Conditional Trigger is what happens when pre-defined alerts meet the power of automated trading. Most alert systems tell you when something happens. Conditional Triggers execute orders when conditions are met.

This is true automation available right on APIs, wherein computation load shifts from your systems to our systems - with the heavy lifting happening right on our infrastructure, and reducing the effort of writing logic at your end.

What does this changes mean for Algo Traders and Developers?

With the Conditional Trigger APIs, your strategies stay active across the trading sessions. Indicators and signals that once required monitoring are now accessible directly through the API, removing unnecessary steps and calculations.

Your logic no longer waits for intervention; it reacts the moment market conditions align right on our servers. As a developer, you do not need to worry about knowing each indicator calculation or building separate functions for each calculation - just an API call, and you skip data ingestion processes, calculations and order placement logic.

From the very first condition, you trade the way you think. With support for more than 20 technical indicators, including RSI, Moving Averages, Bollinger Bands, MACD, Stochastic, and ATR, you can express strategies naturally and precisely. Compare prices with indicators, indicators with fixed levels, or indicators with each other, without building complex computation layers or relying on fragile workarounds.

Currently, we support the following technical indicators on Dhan:

  1. Simple Moving Average (5 periods)
  2. Simple Moving Average (10 periods)
  3. Simple Moving Average (20 periods)
  4. Simple Moving Average (50 periods)
  5. Simple Moving Average (100 periods)
  6. Simple Moving Average (200 periods)
  7. Exponential Moving Average (5 periods)
  8. Exponential Moving Average (10 periods)
  9. Exponential Moving Average (20 periods)
  10. Exponential Moving Average (50 periods)
  11. Exponential Moving Average (100 periods)
  12. Exponential Moving Average (200 periods)
  13. Upper Bollinger Band
  14. Lower Bollinger Band
  15. Relative Strength Index
  16. Average True Range
  17. Stochastic Oscillator
  18. Stochastic RSI
  19. MACD long-term component
  20. MACD short-term component
  21. MACD histogram

While we plan to add many more, we would like to know from you which ones we should add next. Also, currently following timeframes are allowed while placing conditional trigger:

  1. 1-minute candles
  2. 5-minute candles
  3. 15-minute candles
  4. Daily candles

When a condition is met, you can trigger a single order or coordinate multiple orders at once. As markets move, your positions move with them, allowing your strategy to adapt without being rewritten mid-trade. Your conditions translate directly into real market orders, executed automatically and exactly when your logic demands, this is automation in its truest nature.

You can modify conditions or order parameters at any time without canceling and rebuilding so that your control does not end after deployment. Every trigger is trackable through postback updates, all active conditions remain visible through the API, expiry dates keep strategies time-bound, and notes preserve the reasoning behind every setup.

The Conditional Trigger API is currently available for Equities and Indices, with support for intraday timeframes of 1-minute, 5-minute, and 15-minute as well as daily timeframes.

The complete API documentation with all endpoints, parameters, and response structures is live on DhanHQ API Documentation - here.

As always, we’ll keep evolving this based on how you use it. We’re already working on expanding instrument coverage and adding more technical indicators. Your feedback matters, whether it’s a feature request, a bug report, or just sharing what strategies you’re building with this.

Happy Building!
Hardik

4 Likes