Hi @Deodas_kumar ,
Do refer the below code:
Open Source Backtesting - Google Drive
Also we will go in depth on how to backtest on upcoming OSB videos
Hi @Deodas_kumar ,
Do refer the below code:
Open Source Backtesting - Google Drive
Also we will go in depth on how to backtest on upcoming OSB videos
Hi @rahulcse56 ,
Also try to increase the length of data… which will help out to smooth value for ema calcuation
make changes in Dhan_Tradehull in get_start_date… change 2 days to 4 days… and try to get ema again
if ohlc['status']!='failure':
df = pd.DataFrame(ohlc['data'])
if not df.empty:
df['timestamp'] = df['timestamp'].apply(lambda x: self.convert_to_date_time(x))
start_date = df.iloc[-4]['timestamp']
start_date = start_date.strftime('%Y-%m-%d')
return start_date, to_date
else:
return start_date, to_date
else:
return start_date, to_date
Tagging @Hardik for same
Hello Sir @Tradehull_Imran , can you please give quick guide for how to install all the libraries in the file ‘install libraries.bat’ in the cloud platform, for deploying the strategy on cloud platform like AWS?
Solution link
Hi @Swapnil_Sutar
This topic is covered in detail in upcoming advance algo trading series
Please try to run it in market hour and share the output with us
hi @Tradehull_Imran sir,
where can i find get_option_chain() method. i got error
option_chain = tsl.get_option_chain(Underlying=“NIFTY”, exchange=“INDEX”, expiry=0, num_strikes=10)
AttributeError: ‘Tradehull’ object has no attribute ‘get_option_chain’
while using this code
# Import your Dhan Tradehull module
from Dhan_Tradehull_V2 import Tradehull
# Initialize API client
client_code = "123"
token_id = "abd"
tsl = Tradehull(client_code, token_id)
# Fetch NIFTY option chain (nearest expiry, 10 strikes above & below ATM)
option_chain = tsl.get_option_chain(Underlying="NIFTY", exchange="INDEX", expiry=0, num_strikes=10)
# Convert response to DataFrame for better readability (if needed)
import pandas as pd
df = pd.DataFrame(option_chain)
# Display Option Chain Data
print(df)
Okay
Response for Rejection
EXCH:16052:Function Not Available
what is the issue
orderbook[premium_name][“sl”] = last_candle[“low”]
sl_orderid = tsl.order_placement(
tradingsymbol=orderbook[premium_name]["name"],
exchange="NFO",
quantity=orderbook[premium_name]["qty"],
price=0,
trigger_price=orderbook[premium_name]["sl"],
order_type="STOPMARKET",
transaction_type="SELL",
trade_type="MIS",
)
order_status = tsl.get_order_status(orderid=sl_orderid)
if order_status:
orderbook[premium_name]["sl_orderid"] = sl_orderid
orderbook[premium_name]["traded"] = "yes"
print(f"Sl Order executed, Verify at your end")
else:
print("Sl Order not placed.")
break
@Everyone please change this in How to use updated codebase.py file
From
ce_name, pe_name, ce_strike, pe_strike = tsl.ITM_Strike_Selection(Underlying='NIFTY', Expiry=0, OTM_count=5)
To
ce_name, pe_name, ce_strike, pe_strike = tsl.ITM_Strike_Selection(Underlying='NIFTY', Expiry=0, ITM_count=5)
=====================
@ Everyone : actually below me method takes ITM_count count as parameter not OTM_count
(method) def ITM_Strike_Selection(
Underlying: Any,
Expiry: Any,
ITM_count: int = 1
) → Any
@Tradehull_Imran sir can you please update same to How to use updated codebase.py
Hi @anandc ,
Do use the updated codebase:
3.1 Codebase Upgrade.zip - Google Drive
First_5_min_open = current_close_data.iloc[-2]['open']
First_5_min_close = current_close_data.iloc[-2]['close']
one question Imran sir @Tradehull_Imran,
i called intraday data with 5
min time frame, At 9:25
this code above should give me 9:15
Open
close
etc.
but it provides 9.20
`readings.
so it considered 9.25
readings are last, and 9:20
s as second last.
but 9:25
s readings are not written till 9:29
(which will provide 9:25 candles close). so how is it possible ?
What am I doing wrong here sir ?
Hi @Ganesh ,
can you elaborate what is the issue in detail.
also send error screenshot
Do send the complete code.
also buy and sell signal seems to be correct.
index_chart['SC1'] = (index_chart['WILLR'].shift(1) <= upper_limit) & (index_chart['WILLR'] > upper_limit)
can you export the index_chart with Potential Buy/Sell Signal to csv… and then check the index_chart[‘SC1’] is True for 10 Feb 14:42… as in console we are able to see only last 5 candle info
It seems the code is working fine for BANKEX, do check and let know if you still face issues :
Hi @Dhananjay_Umalkar ,
At 9:25, 9:25’s candle is the running candle. 9:20 is the last completed candle which can be accessed using data.iloc[-2]. So to get the 9:15 candle close , code needs be for data.iloc[-3]