Dhan Algo Trading — Automate Your Strategies | Tradetron
Dhan + Tradetron

Automate Your
Dhan Trading

To automate trading on Dhan, register a Tradetron virtual server address in DhanHQ Trading APIs, paste your Dhan access token and Client ID into Tradetron, and deploy a strategy: Tradetron places the orders through Dhan's API, and you write no code. Dhan's access token lasts one day, so you generate a fresh one in Dhan and paste it into Tradetron each trading day.

Start Free — Connect Dhan

Free forever plan available.

9,000+ traders run strategies on Dhan via Tradetron
Dhan algo trading with Tradetron
Step by step

How to automate trading on Dhan

Set it up once with these steps, in this order. Field names follow the Dhan connection form on Broker & Exchanges.

  1. Add Dhan on Tradetron

    On Broker & Exchanges, click Add Broker, pick Dhan and save with placeholder details for now. This unlocks Enable virtual server.

  2. Enable a virtual server

    On the broker's edit page, click Enable virtual server and pick a plan (from Rs 100 a month + GST). Tradetron emails you the server's address; Dhan accepts API orders only from an address you register with it.

  3. Register the address with Dhan

    Log in to Dhan, open DhanHQ Trading APIs and its IP setting, enter the virtual server's address in IP Address 1 or IP Address 2 (one is enough) and save.

  4. Generate your access token

    In DhanHQ Trading APIs, click Generate Access Token and copy the token.

  5. Enter the token in Tradetron

    On Broker & Exchanges, paste the token into token and your Dhan Client ID into ClientID, save, then use the Click Here link on the broker card to check the token is recognised.

  6. Deploy a strategy

    Build a strategy in the no-code builder or pick one from the marketplace, choose Dhan as the broker and deploy. Live Offline runs it on live prices and shows each signal without placing an order; Live Auto places the orders at Dhan.

Every trading day. Dhan's access token is valid for one day and does not refresh by itself. Generate a new one in DhanHQ Trading APIs each trading day and paste it into Tradetron.

Why the virtual server. Under SEBI's framework for retail algo trading, every Indian broker accepts API orders only from an address registered with it (all brokers from 1 April 2026). Your strategies run on Tradetron's servers, so the address Dhan needs is your virtual server's, never your home or office address.

Updated 24 Oct 2026. Steps follow Tradetron's Dhan connection guide; broker screens can change, and the guide has the current labels. Trading in securities and derivatives carries a risk of loss. Tradetron is a software platform, not an investment adviser, and does not tell you what to trade. A backtest shows how rules behaved on past data and is not a forecast.

How it works

Three steps to automated trading

Set up once. Trade forever. Here's how to get your Dhan account running on autopilot.

1

Build your strategy

Use Tradetron's no-code builder to create entry/exit rules, position sizing, and stop-loss logic — no programming needed.

2

Connect Dhan

Link your Dhan account in minutes. One-time setup, then Tradetron handles order placement automatically.

3

Trade on autopilot

Your strategy runs through market hours — scanning signals, placing orders, and managing risk while you focus on what matters.

Why Tradetron

Built for serious Dhan traders

Trade the segments you need, with the reliability professional traders demand.

✓
Supports Equity, F&O, Commodity Trade across all asset classes available on Dhan.
✓
Reliable order execution Orders placed directly through Dhan's official API.
✓
No coding required Build complex strategies with conditions, scanners, and risk management — all visual.
✓
See every signal before you go live In Live Offline, Tradetron runs your strategy on live prices and shows you each signal. It places no order; you may place the trade yourself at your broker.
✓
Switch brokers without rebuilding Your strategy logic stays intact when you switch — connect a different broker without starting over.
✓
Marketplace of 1,000+ strategies Subscribe to strategies built by creators and deploy them in a few clicks.
Getting connected

How to connect Dhan

One-time setup

Link your account

Enable a Tradetron virtual server and register its address in DhanHQ Trading APIs, generate an access token on Dhan, and enter it with your Client ID in Tradetron.

Setup once
Daily login

Refresh your session

Dhan's access token lasts one day: generate a fresh one in DhanHQ Trading APIs each trading day and paste it into Tradetron.

Takes ~30 seconds

☀ Your trading day, automated

🔑
8:30 AMRefresh token (30s)
⚙️
9:15 AMMarket opens
📈
All dayStrategies run
✓
Market closeYou stay in control

A few things to know about Dhan

  • Put your Tradetron virtual server's address in IP Address 1 or IP Address 2 on Dhan; one field is enough.
  • Uses a self-generated daily access token and your Client ID (no API key and secret pair).
  • There is no auto-refresh: a token from yesterday is refused.

Need step-by-step guidance? Read the Dhan connection guide →

FAQ

Common questions about
Dhan algo trading

Do I need to know how to code?

No. Tradetron's builder is fully no-code; you can also deploy ready-made strategies from the marketplace in a few clicks.

Is automated trading allowed on Dhan?

Yes. Tradetron connects through Dhan's official API. You stay in full control of your account and funds.

Why do I need to log in to my broker every day?

Under the exchange rules for retail algo trading, every broker API session is logged out each day before the next trading day begins. So each broker asks you to log in again, or generate a new token, before you trade. It is not a Tradetron limit.

Can I try it before paying?

Yes. Tradetron is free to start — sign up with your email, build a strategy, and paper trade at no cost.

How do I connect my Dhan account to an algo trading platform like Tradetron?

Enable a Tradetron virtual server and register its address in DhanHQ Trading APIs, generate an access token in Dhan, and paste the token and your Dhan Client ID into Tradetron's Broker & Exchanges page. Then deploy a strategy with Dhan as the broker; Tradetron places the orders through Dhan's API.

How do I get my Dhan access token?

In Dhan, open My Profile > DhanHQ Trading APIs and click Generate Access Token. Copy it and paste it into the token field on Tradetron's Broker & Exchanges page, with your Dhan Client ID in ClientID, then use the Click Here link on the broker card to check it.

How long does a Dhan access token last?

One day. It does not refresh by itself, so you generate a fresh token in DhanHQ Trading APIs each trading day and paste it into Tradetron before you trade.

Which IP field do I fill in on Dhan?

Either IP Address 1 or IP Address 2 works: put your Tradetron virtual server's address in one and leave the other blank. Brokers let you change the registered address at most once a week, so copy it exactly from Tradetron's email.

Can I backtest a strategy before running it on Dhan?

Yes. Any Tradetron strategy can be backtested on 1-minute NSE and NFO history from January 2020 before you deploy it on Dhan. A backtest shows how the rules behaved on past data; it is not a forecast. See tradetron.tech/backtest/nifty-options.

Ready to automate your Dhan trades?

Join thousands of traders who run their strategies on autopilot with Tradetron.

Get Started Free