Learn Algo Trading with Python | Codes | Youtube Series

HI @Tradehull_Imran Sir,

How to write Linear regression Curve indicator, Please share the code, Sir.
The code is not available in https://ta-lib.github.io/

import tradehull
import dhanhq
import madefortrade

api = dhanhq required_people_intrested = (100 // 6)

url = “Learn Algo Trading with Python | Codes | Youtube Series

people_intrested = madefortrade.get_live_data(url)

if people_intrested > required_people_intrested:
print(“red_circle GO LIVE SESSION ON YOUTUBE”)
print("red_circle BUILD ALGO LIVE ")
print(“red_circle LIVE QUESTIONS AND ANSWER IMPLEMENTATION”)
else:
print(“Wait hourglass_flowing_sand”)
print(“SEND ME YOUR ANSWER IN CODE”)

result will be

If people_interested > 16:

:red_circle: GO LIVE SESSION ON YOUTUBE
:red_circle: BUILD ALGO LIVE
:red_circle: LIVE QUESTIONS AND ANSWER IMPLEMENTATION

If people_interested <= 16:
Wait

1 Like

@Tradehull_Imran
How can i use this function

tsl.get_intraday_data(tradingsymbol,exchange,timeframe, debug=“NO”)

I have tried running like this in my code
tradingsymbol = ‘RELIANCE’

exchange = ‘NSE’

timeframe = ‘5T’

tsl.get_intraday_data(tradingsymbol,exchange,timeframe, debug=“NO”)

then got error like this

{‘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’}}
Traceback (most recent call last):
File “d:\Algo_Trade\oialgo\Dhan_Tradehull_V2.py”, line 333, in get_intraday_data
raise Exception(ohlc)
Exception: {‘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 sir,
kya buy or sell ke liye Functions bana sakte hai. sir please help

if (ba_c[‘close’] > level_value):
breakout_levels.append(f"Above {level_name} ({level_value})")

        if  (breakout_levels == "Above") and (index_chart['rsi'] > 55) and (ba_c['close'] > ic['close']):
           Functions ("buy")

@Tradehull_Imran
Please tell me how can i use your function

tsl.get_option_greek()

in my code.
I want to understand, what are the input parameter that i need to provide and what are the output that i will receive from this function.

Thanks in advance

Hi @vinay_kumaar
Send the AMO code file as well

Hi @SUKANTA_MONDAL

added in video topics +1

Hi @Kishore007

Try this page : TA-Lib

1 Like

Hi @IMRANUL_HAQUE_NOOR

Below are the timeframes you can pass

			available_frames = {
				2: '2T',    # 2 minutes
				3: '3T',    # 3 minutes
				5: '5T',    # 5 minutes
				10: '10T',   # 10 minutes
				15: '15T',   # 15 minutes
				30: '30T',   # 30 minutes
				60: '60T'    # 60 minutes
			}

also get_intraday_data gives data for today only,

better is to use get_historical_data, it gives data from last 2 working days

Hi @avinashkumar07412

use below pseudocode


def sell_condition(name):

	ce_name, pe_name, strike   = tsl.ATM_Strike_Selection(Underlying =name,Expiry ='28-11-2024')
	lot_size                   = tsl.get_lot_size(ce_name)*1
	entry_orderid              = tsl.order_placement(ce_name,'NFO', lot_size, 0, 0, 'MARKET', 'BUY', 'MIS')
	traded                     = "yes"
	trade_info['options_name'] = ce_name
	trade_info['qty']          = lot_size
	trade_info['sl']           = first_candle['low']
	trade_info['CE_PE']        = "PE"






while True:

	# code for data and indicator..




	# ---------------------------- SELL ENTRY CONDITIONS ----------------------------
	sc1 = first_candle['close'] < first_candle['vwap']                # First Candle close is below VWAP
	sc2 = first_candle['close'] < first_candle['SUPERT_10_2.0']       # First Candle close is below Supertrend 
	sc3 = first_candle['close'] < first_candle['vwma']                # First Candle close is below VWMA
	sc4 = first_candle['rsi'] > 20                                    # First candle RSI < 80	
	sc5 = second_candle['volume'] > 50000                             # Second candle Volume should be greater than 50,000 for Nifty and above 125,000 for Bank Nifty
	sc6 = traded == "no"
	sc7 = index_ltp < first_candle['high']
	print(f"SELL \t {current_time} \t {sc1} \t {sc2} \t {sc3} \t {sc4} \t {sc5} \t {sc7} \t first_candle {str(first_candle['timestamp'].time())} \n")


	if bc1 and bc2 and bc3 and bc4 and bc5 and bc6 and bc7:
		print("Sell Signal Formed")
		sell_condition(name)

Hi @IMRANUL_HAQUE_NOOR

Check this link : Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

HI @Tradehull_Imran
CAN I PRINT TOTAL ASK AND BID QUENTITY AND PRICE DATA FOR CASH MARKET.

Hi @Tradehull_Imran , sir .

Linear regression Curve code is not there in that page, sir…

Please check and send me the code, sir…

Hi sir,
NIFTY 50 idex data problem pls help

index_chart = tsl.get_historical_data(tradingsymbol=‘NIFTY’, exchange=‘NSE_IDX’, timeframe=“5”)
Exception in Getting OHLC data as ‘NSE_IDX’

I have bought a few stocks for long term. Will “order_details = tsl.cancel_all_orders()” cancel/sell my CNC stocks in my portfolio also ?

Hi @s_nandi

use this file : Dhan_Tradehull_V2.py - Google Drive

and use below code
bid_ask_data = tsl.get_quote_data(names = [‘NIFTY DEC FUT’])

Hi @Kishore007

use this code

import talib

chart = tsl.get_historical_data(tradingsymbol = 'NIFTY',exchange = 'INDEX',timeframe="5")
chart['linear_regression_curve']     = talib.LINEARREG(chart['close'], timeperiod=60)

Hi @avinashkumar07412

use below code
tsl.get_historical_data(tradingsymbol='NIFTY', exchange='INDEX', timeframe='5')

1 Like

Hi @SUMAN_CHANDRA_GHOSH

tsl.cancel_all_orders() will close only MIS positions, so no impact on NRML positions.

Hi @Tradehull_Imran, Have you been able to check regarding this error?

Thanks