How to fetch live ATR, 333 EMA igh Low from stocks through py code

How to fetch live ATR, 333 EMA high Low from stocks through py code

GOLDPETAL LTP: 14624
'Got exception in place_order as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Invalid IP’}, ‘data’: ‘’}
Dummy order placed. Order ID: None | Price: 13161.6 (won’t fill)

If this still failed, trying SEM_TRADING_SYMBOL as fallback…
'Got exception in place_order as Check the Tradingsymbol
Fallback attempt result. Order ID: None, dhan static IP not working

Hi @GautamB

This is a static ip issue,
are you running the code from a server, if yes, is IPV4 and Static ip registered on Dhan api panel.

Thank you, solved now. How to fetch live ATR, 333 EMA high Low from stocks through py code

Hi @GautamB

See this video on how to create indicators

Also attaching a sample code

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


client_code  = ""
token_id     = ""
tsl          = Tradehull(client_code, token_id, mode="access_token")


chart = tsl.get_historical_data(tradingsymbol='NIFTY', exchange='INDEX', timeframe="5")


chart['ATR'] = talib.ATR(chart['high'], chart['low'], chart['close'], timeperiod=14)


chart['ema'] = talib.EMA(chart['close'], timeperiod=333)


image

1 Like