Python Automated Trading Strategy Creation

Job ID: 40437803

Budget: ₹600 – ₹1,500 INR

Need a python develper to test/upgrade the python . The code is ready just need to test. Create a Python-based automated trading strategy for Dhan using DhanHQ APIs and WebSocket live data.

The strategy should fetch live NIFTY option chain premium data using WebSocket and continuously monitor 1-minute candles of option premiums.

The strategy will work only between market open and 11:00 AM IST.

STEP 1 — OPTION SELECTION

* Identify ATM strike of NIFTY.
* Use ATM-1 strike as the confirmation strike.
* Use ITM strike for actual trade execution.
* Current week expiry should be used.

STEP 2 — INDICATORS

Calculate on 1-minute timeframe using option premium candles:

* 20 EMA
* VWAP

Both indicators must be calculated on option premium data, not on spot index price.

STEP 3 — BULLISH CALL ENTRY CONDITIONS

At exactly 10:00 AM IST:

Check the completed 9:59 AM candle of ATM-1 CE option.

Bullish CE trade should trigger only if:

1. 9:59 candle close is ABOVE 20 EMA
2. 9:59 candle close is ABOVE VWAP

If both conditions are true:

* Buy an ITM Call Option (CE) at market price at 10:00 AM.

Additional confirmation:

* 1-minute VWAP confirmation is mandatory before entry.

STEP 4 — BULLISH PUT FILTER

At exactly 10:00 AM IST:

Check ATM-1 PE option.

If:

1. 9:59 candle close is BELOW 20 EMA
2. 9:59 candle close is BELOW VWAP

then avoid CE buy or use it as bearish confirmation.

STEP 5 — BEARISH PUT ENTRY CONDITIONS

At exactly 10:00 AM IST:

Check completed 9:59 candle of ATM-1 PE option.

Bearish PE trade should trigger only if:

1. 9:59 candle close is ABOVE 20 EMA
2. 9:59 candle close is ABOVE VWAP

If both conditions are true:

* Buy an ITM Put Option (PE) at market price at 10:00 AM.

STEP 6 — BEARISH CALL FILTER

Check ATM-1 CE option.

If:

1. 9:59 candle close is BELOW 20 EMA
2. 9:59 candle close is BELOW VWAP

then use it as additional bearish confirmation for PE buy.

STEP 7 — RISK MANAGEMENT

After entry:

* Fixed Stop Loss = 10% of entry premium
* Fixed Target = 20% of entry premium

Example:

* Entry at ₹100
* Stop Loss = ₹90
* Target = ₹120

STEP 8 — UNIVERSAL EXIT

Regardless of profit or loss:

* Exit all open positions exactly at 11:00 AM IST.
* No overnight positions.
* Only one trade per day.

STEP 9 — EXECUTION REQUIREMENTS

The Python code should include:

* DhanHQ login integration
* WebSocket live premium data fetching
* Real-time candle creation from tick data
* EMA calculation
* VWAP calculation
* ATM and ITM strike identification
* Market order placement
* Stop loss and target management
* Auto exit at 11:00 AM
* Logging and error handling

STEP 10 — TECHNOLOGY REQUIREMENTS

Use:

* Python
* DhanHQ API
* WebSocket streaming
* Pandas
* TA-Lib or pandas-ta for EMA/VWAP calculations

The strategy should be fully automated and suitable for live execution.