excited and waiting for the new video.
We recently did a podcast with a known algo trader : Dharmik Thakker. He shared his journey from manual trading to algo trading, highlighting the evolution of strategies, the role of emotions, and the benefits of automation in trading.
His key advice included starting with rule-based strategies, focusing on backtesting and forward testing, managing risks with proper stop-losses, and diversifying across strategies for consistent results.
He also touched base upon SEBI’s evolving regulations, as he sits in the SEBI committee on Algo Trading as well.
Do watch:
Hi sir,
please send Dhan_Tradehull_V3 file google drive link
Hi @avinashkumar07412
The Dhan_Tradehull_V3 is in development as of now. We will notify when we release it.
Hi @Scooby_Doo
Will check this case in live market
there is no problem for getting daily historical data, but problem for ‘1’, ‘5’, ‘15’ upto 60 min data. Using API version V2. As of today the same problem continues
Also there is problem with tsl.OTM_Strike_Selection(‘NIFTY’,‘28-11-2024’, 3)
not getting strikes - getting blank list
I am not sure if anyone facing the same issue
from Dhan_Tradehull_V2 import Tradehull
# client_code = os.getenv('CLIENT_CODE')
# token_id = os.getenv('TOKEN_ID')
client_code = ""
token_id = ""
tsl = Tradehull(client_code,token_id)
try:
ohlc_data = tsl.get_historical_data(tradingsymbol = 'NIFTY', exchange = 'INDEX', timeframe='5')
except ValueError as e:
print("Error fetching ohlc")
print(ohlc_data)
Got the instrument file
If using all scalar values, you must pass an index
Traceback (most recent call last):
File “/home/mohan/Dhan-Alog-Trading/examples/Dhan_Tradehull_V2.py”, line 259, in get_historical_data
df = pd.DataFrame(ohlc[‘data’])
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/mohan/miniconda3/envs/dhan-test/lib/python3.12/site-packages/pandas/core/frame.py”, line 778, in init
mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/mohan/miniconda3/envs/dhan-test/lib/python3.12/site-packages/pandas/core/internals/construction.py”, line 503, in dict_to_mgr
return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/mohan/miniconda3/envs/dhan-test/lib/python3.12/site-packages/pandas/core/internals/construction.py”, line 114, in arrays_to_mgr
index = _extract_index(arrays)
^^^^^^^^^^^^^^^^^^^^^^
File “/home/mohan/miniconda3/envs/dhan-test/lib/python3.12/site-packages/pandas/core/internals/construction.py”, line 667, in _extract_index
raise ValueError(“If using all scalar values, you must pass an index”)
ValueError: If using all scalar values, you must pass an index
None
@RahulDeshpande Thanks for posting this
Who ever need indicator based algo strategy or confusion with indicator based algo using Dhan api, they can check below @Tradehull_Imran sir’s this video
Waow weekend gift from @Dhan and @Tradehull_Imran sir
Hello @Tradehull_Imran ,
Thank you is just a tiny word for the knowledge you are sharing. All the videos are, as always ( way Above my judgment level ) so I am yet to find the correct word, whether it’s good, great, super, awesome, or maybe there is some better word out there. But eak baat to pakki hain aap hume algo trader bana hi doge
By any chance can we calculate below :
- Previous days/weeks/months’ candle color
- daily / weekly/monthly average candle height of last few days/ weeks/ months
- Calculate/incorporate other charting methods like Heikin ashi/Renko in our strategy
Hi
@Tradehull_Imran
How do i remove the stock from traded watch list (append)
When my position getting zero and ready to take a new trade in same stock
if sl_hit or tg_hit:
print(“Order Exited”, trade_info)
exit_orderid = tsl.order_placement(trade_info[‘stock_name’],‘NFO’, lot_size, 0, 0, ‘MARKET’, ‘BUY’, ‘NORMAL’)
traded_wathclist.remove(stock_name)
Is this Ok
Thank you
Hi @Hardik @RahulDeshpande @Dhan is there any plan to increase daily data api rate limit which is currently 7000 max
I know you guys are fulfilling enough things. But this is also very important please try understand.
Hello @Tradehull_Imran sir,
So, as per chart 7000 daily
So sir if you implement tick by tick data
It will be max
7000/60 = 116.67 approx Mins Max
Means
116.67 /60 = 1.94 approx 2Hrs Max
Am I right sir ?
So @Tradehull_Imran sir
Just asking that data api always payable limited right ?
I am thinking what will be the optimising approach to use it wisely.
And 2ndly I am thinking alternative way until Dhan will increase their api limit
Thinking like kind of load balancer
Suppose I have two family account with both data api subscription.
Can I just switch other account for data api only.
Like try catch method (in catch block with a callback function)
I will wait for your valuable feedback
Thanks in advance
import pdb
import time
import datetime
import traceback
from Dhan_Tradehull_V2 import Tradehull
import pandas as pd
from pprint import pprint
import talib
import pandas_ta as pa
import pandas_ta as ta
import warnings
warnings.filterwarnings(“ignore”)
client_code = “1100578034”
token_id = “”
tsl = Tradehull(client_code,token_id)
index_chart = tsl.get_historical_data(tradingsymbol=‘NIFTY NOV FUT’, exchange=‘NFO’, timeframe=“5”)
rsi ------------------------ apply indicators
index_chart[‘rsi’] = talib.RSI(index_chart[‘close’], timeperiod=14)
pdb.set_trace()
Hello @Tradehull_Imran,
last video was awesome.
could you please provide Session 9 (3rd live algo) files ?
I have 1 query:- why do we need to run websocket.py? because in video you are using websocket.py to get ltp data.
Its Old video
Now We have updated version TradehullV2 so we do not require to run websockel
3re algo files link already given on youtube
Hi @TAPAS_KUMAR_DUTTA
Thanks
you can choose any timeframe, lets assume we use daily data
chart = tsl.get_historical_data(tradingsymbol = 'NIFTY', exchange = 'INDEX', timeframe='DAY')
- Use below code to find candle color
import numpy as np
chart['previous_close'] = chart['close'].shift(1)
chart['candle_color'] = np.where(chart['close'] > chart['open'], 'green', 'red')
- Use below code for average_candle_height
chart['Candle Height'] = chart['high'] - chart['low']
average_candle_height = chart['Candle Height'].mean()
- Yes other chart types can be used like Hikenashi / Renko , will add it in todo-videos list
Hi Sir,
Pls create one foler for working file of Dhan websocket, dhan codebase and dhan tradehull. There is multiple version is available and non of the version is working on my computer. no price update in excel file
Hi @Kalpeshh_Patel
Yes the code is okey to remove stock_name from traded_wathclist