Learn Algo Trading with Python | Codes | Youtube Series

Hi @s_nandi

Do check the code references
Zigzag reference1 : ZigZag/zigzag_demo.ipynb at main · jbn/ZigZag · GitHub
Zigzag reference2 : Zig Zag | Stock Indicators for Python
Zigzag reference3 : true-zigzag/example.py at master · JaktensTid/true-zigzag · GitHub

Yes @Tradehull_Imran works in 2.3.

However, getting

Getting Error at OTM strike Selection as '<' not supported between instances of 'int' and 'str'
None
Enter valid Script Name
'Got exception in place_order as 'NoneType' object has no attribute 'upper'

for

tsl.ITM_Strike_Selection("SENSEX", "27-12-2024", 3)

and also, logging info is incorrect

		except Exception as e:
			print(f"Getting Error at OTM strike Selection as {e}")
			return None,None,0,0

Hi @Rajashekhar_Rangappa

Algo will be stopped when our local system goes to sleep.

To manage it we deploy our algo on server like AWS,
We have covered deployment of Algo in upcoming series for Advance algo trading

1 Like

Hi @rohit2312

Do check

yeah. you are right.

That’s a very great news. :blush: Have also started looking into AWS setup. If you are planning to cover in the upcoming session then will park it.
Thanks again :clap: appreciate it

1 Like

Hi @Krishan_Kant_Sinha

Rate limit issues are not coming as of now, on my end
Do use this file : Dhan_Tradehull_V2.py - Google Drive

Also do apply this excellent solution by @thakurmhn

Hi @balrajsingh

live_pnl = tsl.get_live_pnl(), seems to be working fine on my end,
can you share the complete error as well

do use the latest codebase link : Dhan_Tradehull_V2.py - Google Drive

Hi @kristrades99

Its a codebase version issue

Below call is working fine


option_chain   = tsl.get_option_chain(Underlying="NIFTY", exchange="INDEX", expiry=0, num_strikes=30)

do use the latest codebase link : Dhan_Tradehull_V2.py - Google Drive

1 Like

Hi @Vasili_Prasad
It seems talib was not installed correctly on the laptop

make sure you have a python 3.8 version
Link for installation : 2. Session2 - Installation.zip - Google Drive

Hi @vinay_kumaar

use below code to manage the exception
if the index_ltp gets into a exception it will return {} … blank dictionary, so managing it accordingly

try:
	index_ltp      = tsl.get_ltp_data(names = ['NIFTY DEC FUT'])['NIFTY DEC FUT']
	if len(index_ltp) == 0:
		continue

except Exception as e:
	print(e)
	continue

do use the latest codebase link : Dhan_Tradehull_V2.py - Google Drive

1 Like

@Tradehull_Imran FYI… Learn Algo Trading with Python | Codes | Youtube Series - #1726 by Rajashekhar_Rangappa

Hi @Nikhil_Shenoy

As of now there are no issues in historical data

do use the latest codebase link : Dhan_Tradehull_V2.py - Google Drive

Hello @Tradehull_Imran Sir,
How to scan indices [“NIFTY”,‘BANKNIFTY’,‘NIFTYIT’,‘NIFTYAUTO’,‘NIFTYFMCG’]
for RSI and ADX, Its giving error
Exception in Getting OHLC data as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-907’, ‘error_type’: ‘Data_Error’, ‘error_message’: ‘System is unable to fetch data due to incorrect parameters or no data present’}, ‘data’: {‘errorType’: ‘Data_Error’, ‘errorCode’: ‘DH-907’, ‘errorMessage’: ‘System is unable to fetch data due to incorrect parameters or no data present’}}

Hi @Kanha_Meher

use this code to call Index data


tsl.get_historical_data( tradingsymbol="NIFTY", exchange="INDEX", timeframe="1")

also do use the latest codebase : Dhan_Tradehull_V2.py - Google Drive

Hi @Priyesh_Sharma

do send the complete code and error also

mostly while using historical data the name is incorrect or expired, or the exchange passed is incorrect

Hi @Suraj_B

code files for 2. API Traders Meetup & Workshop - Building Blocks

1 Like

Hi @Priyesh_Sharma

below code is working fine now

watchlist = ["NIFTY", "BANKNIFTY"]
traded_watchlist = []

for index_exchange in watchlist:
    time.sleep(1)

    chart_1 = tsl.get_historical_data(tradingsymbol=index_exchange, exchange='INDEX', timeframe="1")
    chart_5 = tsl.get_historical_data(tradingsymbol=index_exchange, exchange='INDEX', timeframe="5")  # Updated to get_historical_data call
    chart_15 = tsl.get_historical_data(tradingsymbol=index_exchange, exchange='INDEX', timeframe="15")  # Updated to get_historical_data call

    if chart_1 is None or chart_5 is None or chart_15 is None:
        continue

    if chart_1.empty or chart_5.empty or chart_15.empty:
        continue

    # Conditions that are on the 1-minute timeframe
    chart_5['rsi'] = talib.RSI(chart_5['close'], timeperiod=14)  # Calculate RSI on the 5-minute timeframe
    cc_5 = chart_5.iloc[-1]  # Get the last completed candle of the 5-minute timeframe

    print(index_exchange, "RSI on 5 Min Time Frame is", cc_5['rsi'])



    print(chart_1)
    print(chart_5)
    print(chart_15)

Also for “NIFTYIT”, “NIFTYAUTO”, “NIFTYFMCG”, there seems to be some issue , I will have to check on that

Hi @SUKANTA_MONDAL

for simultaneously managing call and put together, we need to study “how to manage multiple position together”, the same topic is covered in great detail in upcoming advance algo trading series.

1 Like

[quote=“Priyesh_Sharma, post:1716, topic:32718”]

Sure sir, it wiil be helpful as Iam creating a scanner to scan indices before jumping in trade.
Thanks

1 Like

Hi @Rajashekhar_Rangappa

Use below code


ce_name, pe_name, ce_OTM_price, pe_OTM_price = tsl.ITM_Strike_Selection(Underlying='SENSEX', Expiry=0, ITM_count=3)