Learn Algo Trading with Python | Codes | Youtube Series

Where to find all the videos of Introduction to Algo Trading for beginners.. Pls

check 3-4 posts above . you will find the you tube link

1 Like

what about 2,3,4,5, videos

We are starting from this video
This is the first one

1 Like

sir ye link open nahi ho rahi koi or tarika he

image

sir ye update file kahan se kilegi

Dhan_Tradehull_V2 Algo

can someone recommend my a single or combination of indicator which really gives profit on algo strategy on index options. I just need name of the indicator rest i can figure it out. Thanks in advance

Hi @HASAN_khan ,

The same topics have been covered in the new series. Kindly follow the series for detailed guidance.

Refer the link-

Hi imran

I want to make a momentam stock trading strategy. My entry and exit condition are below.

Entry condition - On the Monday 9.15 am first chek and confirm that macd line (6,13,4) is greater than macd signle (6,13,4) on nifty 50 chart. If condition setisfy than check which sector is in top 5 (from NSE 47 sectors ) within last 30 calendar day. find top 2 stock from top 5 sector within last 30 calendar day. Also check that selected stock price is must be above 10 day moving average. If condition setisfy then take trade top 2 stock from each sector. please dont take trade which stock are already in holding.

Exit condition - (1) Every day 3.15 pm check condition, If Stock goes down below 20 day moving average then exit OR

(2) Check condition On friday 3.15 pm that stock goes down from top 5 rank in each sector then exit.

Please give me python code if possible or help me to build in python.

I am following Step 7 after completing Step 6 (after rebooting) of the β€œStatic IP for Algo Trading: Full Setup” guide, as mentioned below:

7. Connect

  • Use Remote Desktop on Windows.

  • IP: Your Droplet IP.

  • Username: root.

  • Password: The password you created in DigitalOcean credentials.

I am connecting to the Remote Desktop using these credentials.

However, after connecting and entering the server, I only see a black screen.

Kindly guide me to solve this issue.

Hi @MUKESH_PATEL
Yes we can do this Algo, a nearly similar Algo template we have used here

try this video

Hi @Jay_Das

This may be mostly due to smaller configuration size of server,
Do try increasing server config and try again

sir data api lena ho ga kya

sir about hard ha python coz not geting proper help and out come nahi aya ra ha jo chaya vo can u hel me

import pandas as pd
import numpy as np

class NiftyAlgo:
β€œβ€"
NIFTY 15-MIN RANGE + 5-MIN RETEST STRATEGY

RULES:
1. Mark first 15-min candle High/Low as range
2. Wait for breakout (close above high or below low)
3. Wait for retest back to range level
4. Look for candlestick pattern at retest:
   - BUY: Hammer or Bullish Engulfing
   - SELL: Inverted Hammer or Bearish Engulfing
5. Entry: Break of pattern high (buy) / Break of pattern low (sell) on NEXT candle
6. Stop Loss: Pattern candle low (buy) / Pattern candle high (sell)
7. Target: 1:2 Risk-Reward Ratio
"""

def __init__(self, rr_ratio=2.0, retest_tolerance=0.002):
    self.rr_ratio = rr_ratio
    self.retest_tolerance = retest_tolerance
    self.all_trades = []  # Store all completed trades
    self.reset_session()

def reset_session(self):
    self.range_high = None
    self.range_low = None
    self.range_set = False
    self.state = "WAITING_FOR_RANGE"
    self.breakout_direction = None
    self.pattern_candle = None
    self.pending_entry = None
    self.stop_loss = None
    self.target = None
    self.trades = []

# --- CANDLESTICK PATTERN DETECTORS (FIXED) ---

def is_hammer(self, o, h, l, c):
    """Hammer: Small body at top, long lower shadow, little/no upper shadow"""
    body = abs(c - o)
    if body == 0:
        return False
    upper_shadow = h - max(o, c)
    lower_shadow = min(o, c) - l
    
    # RELAXED CONDITIONS for real market data
    return (lower_shadow >= 1.5 * body and   # Lower shadow at least 1.5x body (was 2x)
            upper_shadow <= body * 1.0 and     # Upper shadow <= body (was 0.3x)
            c > o)                             # Bullish (green candle)

def is_bullish_engulfing(self, p_o, p_h, p_l, p_c, o, h, l, c):
    """Bullish Engulfing: Current green candle completely engulfs previous red candle"""
    prev_red = p_c < p_o
    curr_green = c > o
    return (prev_red and curr_green and
            o <= p_c and c >= p_o and        # Relaxed: allow equal
            abs(c - o) >= abs(p_c - p_o))    # Current body >= previous body

def is_inverted_hammer(self, o, h, l, c):
    """Inverted Hammer: Small body at bottom, long upper shadow, little/no lower shadow"""
    body = abs(c - o)
    if body == 0:
        return False
    upper_shadow = h - max(o, c)
    lower_shadow = min(o, c) - l
    
    return (upper_shadow >= 1.5 * body and   # Relaxed: 1.5x instead of 2x
            lower_shadow <= body * 1.0 and    # Relaxed: 1.0x instead of 0.3x
            c < o)                             # Bearish (red candle)

def is_bearish_engulfing(self, p_o, p_h, p_l, p_c, o, h, l, c):
    """Bearish Engulfing: Current red candle completely engulfs previous green candle"""
    prev_green = p_c > p_o
    curr_red = c < o
    return (prev_green and curr_red and
            o >= p_c and c <= p_o and          # Relaxed: allow equal
            abs(c - o) >= abs(p_c - p_o))     # Current body >= previous body

# --- MAIN PROCESSING ---

def process_15min(self, candle):
    """Process first 15-min candle to set range"""
    if not self.range_set:
        self.range_high = candle['high']
        self.range_low = candle['low']
        self.range_set = True
        self.state = "WAITING_FOR_BREAKOUT"
        return {
            "action": "RANGE_MARKED",
            "high": self.range_high,
            "low": self.range_low
        }
    return None

def process_5min(self, candle, prev_candles):
    """Process 5-min candles"""
    result = {"action": "NONE", "state": self.state}
    o, h, l, c = candle['open'], candle['high'], candle['low'], candle['close']
    
    # === STATE: WAITING FOR BREAKOUT ===
    if self.state == "WAITING_FOR_BREAKOUT":
        if c > self.range_high:
            self.breakout_direction = "UP"
            self.state = "WAITING_FOR_RETEST"
            result = {"action": "BREAKOUT_UP", "price": c}
        elif c < self.range_low:
            self.breakout_direction = "DOWN"
            self.state = "WAITING_FOR_RETEST"
            result = {"action": "BREAKOUT_DOWN", "price": c}
    
    # === STATE: WAITING FOR RETEST ===
    elif self.state == "WAITING_FOR_RETEST":
        if self.breakout_direction == "UP":
            # Price comes back to range high area
            near_range = abs(c - self.range_high) / self.range_high < self.retest_tolerance
            in_range = l <= self.range_high <= h
            if near_range or in_range:
                self.state = "WAITING_FOR_PATTERN"
                result = {"action": "RETEST_UP", "price": c}
        
        elif self.breakout_direction == "DOWN":
            near_range = abs(c - self.range_low) / self.range_low < self.retest_tolerance
            in_range = l <= self.range_low <= h
            if near_range or in_range:
                self.state = "WAITING_FOR_PATTERN"
                result = {"action": "RETEST_DOWN", "price": c}
    
    # === STATE: WAITING FOR PATTERN ===
    elif self.state == "WAITING_FOR_PATTERN":
        if len(prev_candles) >= 1:
            prev = prev_candles[-1]
            p_o, p_h, p_l, p_c = prev['open'], prev['high'], prev['low'], prev['close']
            
            # BULLISH PATTERNS
            if self.breakout_direction == "UP":
                hammer = self.is_hammer(o, h, l, c)
                engulfing = self.is_bullish_engulfing(p_o, p_h, p_l, p_c, o, h, l, c)
                
                if hammer:
                    self.pattern_candle = candle
                    self.state = "WAITING_FOR_CONFIRMATION"
                    self.pending_entry = {
                        "type": "BUY", 
                        "trigger": "HAMMER", 
                        "ph": h, 
                        "pl": l
                    }
                    result = {"action": "PATTERN_HAMMER", "direction": "BUY", "sl": l}
                
                elif engulfing:
                    self.pattern_candle = candle
                    self.state = "WAITING_FOR_CONFIRMATION"
                    self.pending_entry = {
                        "type": "BUY", 
                        "trigger": "BULLISH_ENGULFING", 
                        "ph": h, 
                        "pl": l
                    }
                    result = {"action": "PATTERN_BULLISH_ENGULFING", "direction": "BUY", "sl": l}
            
            # BEARISH PATTERNS
            elif self.breakout_direction == "DOWN":
                inv_hammer = self.is_inverted_hammer(o, h, l, c)
                engulfing = self.is_bearish_engulfing(p_o, p_h, p_l, p_c, o, h, l, c)
                
                if inv_hammer:
                    self.pattern_candle = candle
                    self.state = "WAITING_FOR_CONFIRMATION"
                    self.pending_entry = {
                        "type": "SELL", 
                        "trigger": "INVERTED_HAMMER", 
                        "ph": h, 
                        "pl": l
                    }
                    result = {"action": "PATTERN_INVERTED_HAMMER", "direction": "SELL", "sl": h}
                
                elif engulfing:
                    self.pattern_candle = candle
                    self.state = "WAITING_FOR_CONFIRMATION"
                    self.pending_entry = {
                        "type": "SELL", 
                        "trigger": "BEARISH_ENGULFING", 
                        "ph": h, 
                        "pl": l
                    }
                    result = {"action": "PATTERN_BEARISH_ENGULFING", "direction": "SELL", "sl": h}
    
    # === STATE: WAITING FOR CONFIRMATION (Break of pattern) ===
    elif self.state == "WAITING_FOR_CONFIRMATION":
        entry = self.pending_entry
        
        if entry['type'] == "BUY":
            if h > entry['ph']:
                self.state = "ENTRY_TRIGGERED"
                self.stop_loss = entry['pl']
                result = {
                    "action": "ENTRY_TRIGGERED", 
                    "direction": "BUY",
                    "trigger_price": entry['ph'],
                    "stop_loss": self.stop_loss
                }
        
        elif entry['type'] == "SELL":
            if l < entry['pl']:
                self.state = "ENTRY_TRIGGERED"
                self.stop_loss = entry['ph']
                result = {
                    "action": "ENTRY_TRIGGERED", 
                    "direction": "SELL",
                    "trigger_price": entry['pl'],
                    "stop_loss": self.stop_loss
                }
    
    # === STATE: ENTRY TRIGGERED β†’ EXECUTE ON NEXT CANDLE OPEN ===
    elif self.state == "ENTRY_TRIGGERED":
        entry_price = o  # Entry at next candle open
        risk = abs(entry_price - self.stop_loss)
        
        if self.pending_entry['type'] == "BUY":
            self.target = entry_price + (risk * self.rr_ratio)
        else:
            self.target = entry_price - (risk * self.rr_ratio)
        
        trade = {
            "direction": self.pending_entry['type'],
            "entry": entry_price,
            "sl": self.stop_loss,
            "target": self.target,
            "pattern": self.pending_entry['trigger'],
            "time": candle['timestamp']
        }
        self.trades.append(trade)
        
        result = {
            "action": "TRADE_EXECUTED",
            "direction": self.pending_entry['type'],
            "entry": entry_price,
            "sl": self.stop_loss,
            "target": self.target,
            "risk": risk
        }
        self.state = "IN_TRADE"
    
    # === STATE: IN TRADE β†’ Monitor SL/Target ===
    elif self.state == "IN_TRADE":
        trade = self.trades[-1]
        
        if trade['direction'] == "BUY":
            if l <= trade['sl']:
                # Save completed trade before reset
                completed_trade = {
                    "direction": trade['direction'],
                    "entry": trade['entry'],
                    "sl": trade['sl'],
                    "target": trade['target'],
                    "pattern": trade['pattern'],
                    "time": trade['time'],
                    "exit": trade['sl'],
                    "pnl": trade['sl'] - trade['entry'],
                    "reason": "SL"
                }
                self.all_trades.append(completed_trade)
                self.reset_session()
                result = {"action": "EXIT", "reason": "SL", "pnl": completed_trade['pnl']}
            
            elif h >= trade['target']:
                completed_trade = {
                    "direction": trade['direction'],
                    "entry": trade['entry'],
                    "sl": trade['sl'],
                    "target": trade['target'],
                    "pattern": trade['pattern'],
                    "time": trade['time'],
                    "exit": trade['target'],
                    "pnl": trade['target'] - trade['entry'],
                    "reason": "TARGET"
                }
                self.all_trades.append(completed_trade)
                self.reset_session()
                result = {"action": "EXIT", "reason": "TARGET", "pnl": completed_trade['pnl']}
        
        else:  # SELL
            if h >= trade['sl']:
                completed_trade = {
                    "direction": trade['direction'],
                    "entry": trade['entry'],
                    "sl": trade['sl'],
                    "target": trade['target'],
                    "pattern": trade['pattern'],
                    "time": trade['time'],
                    "exit": trade['sl'],
                    "pnl": trade['entry'] - trade['sl'],
                    "reason": "SL"
                }
                self.all_trades.append(completed_trade)
                self.reset_session()
                result = {"action": "EXIT", "reason": "SL", "pnl": completed_trade['pnl']}
            
            elif l <= trade['target']:
                completed_trade = {
                    "direction": trade['direction'],
                    "entry": trade['entry'],
                    "sl": trade['sl'],
                    "target": trade['target'],
                    "pattern": trade['pattern'],
                    "time": trade['time'],
                    "exit": trade['target'],
                    "pnl": trade['entry'] - trade['target'],
                    "reason": "TARGET"
                }
                self.all_trades.append(completed_trade)
                self.reset_session()
                result = {"action": "EXIT", "reason": "TARGET", "pnl": completed_trade['pnl']}
    
    return result

@Jay_Das was the server black screen solved. were you able to run the algo

Very Good Morning Sir. You have started another New series: β€˜AI and Algos by Dhan’ I could not traceout the code snippets of these series. What exactly the link, if I have missed them to traceout sir. Thanks a lot sir for all your efforts at Dhan.

1 Like

IMRAN SIR , PLZ , IN DEVLOPER.DHANHQ , SOLVE THIS ERROR & IF POSSIBLE THEN MAKE A FULL VIDEO OF DEPLOYMENT OF ALGO (USING DEPENDENCIES & ENV VARIEBELS)

CODE

from Dhan_Tradehull import Tradehull
import pandas as pd
from rich import print
import time

client_id = {{CLIENT_CODE}}
access_token = {{ACCESS_TOKEN}}

tsl = Tradehull(client_id, access_token)
print(" Dhan session initialized successfully!")


watchlist   = ["WIPRO","TATASTEEL", "JIOFIN"]


for name in watchlist:

    chart           = tsl.get_historical_data(tradingsymbol=name, exchange='NSE', timeframe="5")

    completed_candle = chart.iloc[-2]


    entry_price    = round(completed_candle['close']*1.01, 1)
    sl_price       = round(completed_candle['close']*0.99, 1)
    target_price   = round(completed_candle['close']*1.02, 1)

    orderid =tsl.place_super_order(tradingsymbol=name,   
                            exchange="NSE",    
                            transaction_type="BUY",   
                            quantity=1,   
                            order_type="LIMIT",    
                            trade_type="MIS",    
                            price=entry_price,    
                            target_price=target_price,   
                            stop_loss_price=sl_price,   
                            trailing_jump=0.5)
                            

    print(orderid)

    



    time.sleep(1)
    
                             

ERROR:

β€Ί
Starting execution...
β€Ί
Execution started, waiting for log stream...
β€Ί
Waiting for log stream... (1/24)
β€Ί
Log stream ready, connecting...
β€Ί
[2026-06-29 09:55:16 IST] Starting execution...
β€Ί
[2026-06-29 09:55:22 IST] Installing requirements...
β€Ί
[2026-06-29 09:55:24 IST] [pip] Collecting pandas==3.0.3 (from -r /tmp/requirements.txt (line 1))
β€Ί
[2026-06-29 09:55:25 IST] [pip]   Downloading pandas-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.metadata (79 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 24.1 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:25 IST] [pip] Collecting Dhan-tradehull==3.3.1 (from -r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:25 IST] [pip]   Downloading dhan_tradehull-3.3.1-py3-none-any.whl.metadata (46 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.5/46.5 kB 49.6 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:25 IST] [pip] Collecting dhanhq==2.2.0 (from -r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:25 IST] [pip]   Downloading dhanhq-2.2.0-py3-none-any.whl.metadata (13 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip] Collecting rich==15.0.0 (from -r /tmp/requirements.txt (line 4))
β€Ί
[2026-06-29 09:55:25 IST] [pip]   Downloading rich-15.0.0-py3-none-any.whl.metadata (18 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip] Downloading pandas-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (11.3 MB)
β€Ί
[2026-06-29 09:55:25 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.3/11.3 MB 272.1 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:25 IST] [pip] Downloading dhan_tradehull-3.3.1-py3-none-any.whl (38 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip] Downloading dhanhq-2.2.0-py3-none-any.whl (36 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip] Downloading rich-15.0.0-py3-none-any.whl (310 kB)
β€Ί
[2026-06-29 09:55:25 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 310.7/310.7 kB 222.1 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:25 IST] [pip] Installing collected packages: dhanhq, rich, pandas, Dhan-tradehull
β€Ί
[2026-06-29 09:55:32 IST] [pip] Successfully installed Dhan-tradehull-3.3.1 dhanhq-2.2.0 pandas-3.0.3 rich-15.0.0
β€Ί
[2026-06-29 09:55:32 IST] [pip] 
β€Ί
[2026-06-29 09:55:32 IST] [pip] [notice] A new release of pip is available: 24.0 -> 26.1.2
β€Ί
[2026-06-29 09:55:32 IST] [pip] [notice] To update, run: pip install --upgrade pip
β€Ί
[2026-06-29 09:55:34 IST] [pip] Requirement already satisfied: pandas==3.0.3 in /tmp/pip/lib/python3.11/site-packages (from -r /tmp/requirements.txt (line 1)) (3.0.3)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Requirement already satisfied: Dhan-tradehull==3.3.1 in /tmp/pip/lib/python3.11/site-packages (from -r /tmp/requirements.txt (line 2)) (3.3.1)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Requirement already satisfied: dhanhq==2.2.0 in /tmp/pip/lib/python3.11/site-packages (from -r /tmp/requirements.txt (line 3)) (2.2.0)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Requirement already satisfied: rich==15.0.0 in /tmp/pip/lib/python3.11/site-packages (from -r /tmp/requirements.txt (line 4)) (15.0.0)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Collecting numpy>=1.26.0 (from pandas==3.0.3->-r /tmp/requirements.txt (line 1))
β€Ί
[2026-06-29 09:55:34 IST] [pip]   Downloading numpy-2.4.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Collecting python-dateutil>=2.8.2 (from pandas==3.0.3->-r /tmp/requirements.txt (line 1))
β€Ί
[2026-06-29 09:55:34 IST] [pip]   Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
β€Ί
[2026-06-29 09:55:34 IST] [pip] Collecting mibian>=0.1.3 (from Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:34 IST] [pip]   Downloading mibian-0.1.3.zip (4.3 kB)
β€Ί
[2026-06-29 09:55:34 IST] [pip]   Preparing metadata (setup.py): started
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Preparing metadata (setup.py): finished with status 'done'
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting pytz>=2024.1 (from Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading pytz-2026.2-py2.py3-none-any.whl.metadata (22 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting requests>=2.32.3 (from Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading requests-2.34.2-py3-none-any.whl.metadata (4.8 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting websocket-client>=1.8.0 (from Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading websocket_client-1.9.0-py3-none-any.whl.metadata (8.3 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting pyotp>=2.9.0 (from Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading pyotp-2.10.0-py3-none-any.whl.metadata (10 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting websockets>=12.0.1 (from dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading websockets-16.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.8 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting pyOpenSSL>=20.0.1 (from dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading pyopenssl-26.3.0-py3-none-any.whl.metadata (22 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting markdown-it-py>=2.2.0 (from rich==15.0.0->-r /tmp/requirements.txt (line 4))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading markdown_it_py-4.2.0-py3-none-any.whl.metadata (7.4 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting pygments<3.0.0,>=2.13.0 (from rich==15.0.0->-r /tmp/requirements.txt (line 4))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading pygments-2.20.0-py3-none-any.whl.metadata (2.5 kB)
β€Ί
[2026-06-29 09:55:35 IST] [pip] Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich==15.0.0->-r /tmp/requirements.txt (line 4))
β€Ί
[2026-06-29 09:55:35 IST] [pip]   Downloading mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting cryptography<50,>=49.0.0 (from pyOpenSSL>=20.0.1->dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading cryptography-49.0.0-cp311-abi3-manylinux_2_34_x86_64.whl.metadata (4.3 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting typing-extensions>=4.9 (from pyOpenSSL>=20.0.1->dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting six>=1.5 (from python-dateutil>=2.8.2->pandas==3.0.3->-r /tmp/requirements.txt (line 1))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting charset_normalizer<4,>=2 (from requests>=2.32.3->Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading charset_normalizer-3.4.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (40 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.9/40.9 kB 124.3 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting idna<4,>=2.5 (from requests>=2.32.3->Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading idna-3.18-py3-none-any.whl.metadata (6.1 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting urllib3<3,>=1.26 (from requests>=2.32.3->Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading urllib3-2.7.0-py3-none-any.whl.metadata (6.9 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting certifi>=2023.5.7 (from requests>=2.32.3->Dhan-tradehull==3.3.1->-r /tmp/requirements.txt (line 2))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading certifi-2026.6.17-py3-none-any.whl.metadata (2.5 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting cffi>=2.0.0 (from cryptography<50,>=49.0.0->pyOpenSSL>=20.0.1->dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Collecting pycparser (from cffi>=2.0.0->cryptography<50,>=49.0.0->pyOpenSSL>=20.0.1->dhanhq==2.2.0->-r /tmp/requirements.txt (line 3))
β€Ί
[2026-06-29 09:55:36 IST] [pip]   Downloading pycparser-3.0-py3-none-any.whl.metadata (8.2 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip] Downloading markdown_it_py-4.2.0-py3-none-any.whl (91 kB)
β€Ί
[2026-06-29 09:55:36 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.7/91.7 kB 171.3 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:36 IST] [pip] Downloading numpy-2.4.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.9 MB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.9/16.9 MB 280.4 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading pygments-2.20.0-py3-none-any.whl (1.2 MB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 225.2 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading pyopenssl-26.3.0-py3-none-any.whl (56 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.0/56.0 kB 132.8 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading pyotp-2.10.0-py3-none-any.whl (13 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 kB 163.8 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading pytz-2026.2-py2.py3-none-any.whl (510 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 510.1/510.1 kB 143.0 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading requests-2.34.2-py3-none-any.whl (73 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.1/73.1 kB 107.3 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading websocket_client-1.9.0-py3-none-any.whl (82 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.6/82.6 kB 147.7 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading websockets-16.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (184 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 184.6/184.6 kB 3.8 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading certifi-2026.6.17-py3-none-any.whl (133 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 kB 177.7 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading charset_normalizer-3.4.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (214 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 214.1/214.1 kB 185.0 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading cryptography-49.0.0-cp311-abi3-manylinux_2_34_x86_64.whl (4.7 MB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.7/4.7 MB 237.4 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading idna-3.18-py3-none-any.whl (65 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 167.3 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading typing_extensions-4.15.0-py3-none-any.whl (44 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.6/44.6 kB 99.1 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading urllib3-2.7.0-py3-none-any.whl (131 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 131.1/131.1 kB 149.6 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (215 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 215.6/215.6 kB 156.6 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Downloading pycparser-3.0-py3-none-any.whl (48 kB)
β€Ί
[2026-06-29 09:55:37 IST] [pip]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.2/48.2 kB 142.5 MB/s eta 0:00:00
β€Ί
[2026-06-29 09:55:37 IST] [pip] Building wheels for collected packages: mibian
β€Ί
[2026-06-29 09:55:37 IST] [pip]   Building wheel for mibian (setup.py): started
β€Ί
[2026-06-29 09:55:38 IST] [pip]   Building wheel for mibian (setup.py): finished with status 'done'
β€Ί
[2026-06-29 09:55:38 IST] [pip]   Created wheel for mibian: filename=mibian-0.1.3-py3-none-any.whl size=4071 sha256=79ae29c6e120d75ab52f4d85ab55d8c23b30608671a6aeff771db074f09bfc01
β€Ί
[2026-06-29 09:55:38 IST] [pip]   Stored in directory: /tmp/pip-ephem-wheel-cache-1e6c3e7k/wheels/e7/5e/5c/da32a012a1a27b1f6f61a7744eac2eb20ab4854aba3143b711
β€Ί
[2026-06-29 09:55:38 IST] [pip] Successfully built mibian
β€Ί
[2026-06-29 09:55:38 IST] [pip] Installing collected packages: pytz, mibian, websockets, websocket-client, urllib3, typing-extensions, six, pyotp, pygments, pycparser, numpy, mdurl, idna, charset_normalizer, certifi, requests, python-dateutil, markdown-it-py, cffi, cryptography, pyOpenSSL
β€Ί
[2026-06-29 09:55:44 IST] [pip] Successfully installed certifi-2026.6.17 cffi-2.0.0 charset_normalizer-3.4.7 cryptography-49.0.0 idna-3.18 markdown-it-py-4.2.0 mdurl-0.1.2 mibian-0.1.3 numpy-2.4.6 pyOpenSSL-26.3.0 pycparser-3.0 pygments-2.20.0 pyotp-2.10.0 python-dateutil-2.9.0.post0 pytz-2026.2 requests-2.34.2 six-1.17.0 typing-extensions-4.15.0 urllib3-2.7.0 websocket-client-1.9.0 websockets-16.0
β€Ί
[2026-06-29 09:55:44 IST] [pip] 
β€Ί
[2026-06-29 09:55:44 IST] [pip] [notice] A new release of pip is available: 24.0 -> 26.1.2
β€Ί
[2026-06-29 09:55:44 IST] [pip] [notice] To update, run: pip install --upgrade pip
β€Ί
[2026-06-29 09:55:46 IST] ==================== SCRIPT OUTPUT START ====================
β€Ί
[2026-06-29 09:55:47 IST] Mibian requires scipy to work properly
β€Ί
[2026-06-29 09:55:47 IST] Codebase Version 3.3.1
β€Ί
[2026-06-29 09:55:47 IST] Traceback (most recent call last):
β€Ί
[2026-06-29 09:55:47 IST]   File "/tmp/script.py", line 7, in <module>
β€Ί
[2026-06-29 09:55:47 IST]     access_token =eyJ0eXAiOiJKV1Q*****************************************************************************************************************************************************************************************************VvI6RsT0J-YnyDu18Zv-sFyg 
β€Ί
[2026-06-29 09:55:47 IST]                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
β€Ί
[2026-06-29 09:55:47 IST] NameError: name 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9' is not defined
β€Ί
[2026-06-29 09:55:47 IST] ==================== SCRIPT OUTPUT END ====================
β€Ί
[2026-06-29 09:55:47 IST] Execution failed with exit code: 1
β€Ί
Execution completed.

GIVE SAME DEPENDENCIES USED BY YOU IN YOUR DEMO CODE OR EXPLAIN THAT PART DEPLY TO USE

BEACUSE AS I KNOW MY PYTHON CODE HAVE NO ERROR BUT ERROR IS COMING IN DEVLOPER.DHANHQ

I HAVE SEND SAME ERRORS & CODE IN LAST WEEK BUT I DIDN’T GET ANY RESPONSE , SO PLZ SOLVE THIS AS FAST AS POSIBLE

Hi @Ammar_parihar
yes data api subscription will be required

for this strategy

  1. Mark first 15-min candle High/Low as range
    To get first 15 mins high low range, just call historical data, slice it, and get range

  2. For hammer pattern and bullish engulfing use TA-LIB : https://ta-lib.github.io/ta-lib-python/func_groups/pattern_recognition.html

  3. in this code we are not calling any real data, we will need to subscribe to Data also to make live algo for it

try these changes, and let me know on the progress

Hi @Vasili_Prasad

for code refer this link : https://madefortrade.in/t/learn-algo-trading-with-python-codes-youtube-series/32718/3817?u=tradehull_imran