Hey everyone,
I am a fresher in algo trading, I just want an algo that will call buy nifty atm for 1 lot market order And want an algo that will close all open positions to market orders.
Please help me
Hey everyone,
I am a fresher in algo trading, I just want an algo that will call buy nifty atm for 1 lot market order And want an algo that will close all open positions to market orders.
Please help me
Hi @Dipak_Patil
Check this one : https://www.youtube.com/watch?v=4QmdVg2pPGs&list=PLnuHyqUCoJsPA4l9KRLrNpWLIfZ9ucLxx&index=9
@Tradehull_Imran dear sir I already watched your playlist on YouTube. After that I am here for searching help. I am installing all required tools as per your videos. Now I want a sample code just for nifty at the money option buying. No any conditions required in code.
Hi Imran …
I am working with ATM_Strike_Selection.
ce_name, pe_name, strike = tsl.ATM_Strike_Selection(Underlying=‘IOC’, Expiry=0)
The above command works fine for all instruments except the below ones …
‘BANKBARODA’, ‘COALINDIA’, ‘IOC’, ‘MOTHERSON’, ‘UNITDSPR’
I am not able to figure out the reason for this behaviour …
plz guide me in this regard
@Tradehull_Imran dear sir,
i am a scalper and wanted algo for just entry and exit. i am writing code as per our youtube playlist. and my code is running very well placing orders and exits aslo, but its take to much time to login after running code in cmd. aprox 15 to 20 sec.
if i login 1st and copy paste comand in cmd using “pdb.function” then order will hit emidiatly.
now i am stuck, i can’t understant what i can do. please help.
Below is code
import pdb
import time
import datetime
import traceback
from Dhan_Tradehull import Tradehull
import pandas as pd
client_code = “XXXXXXXX”
token_id = “XXXXXXXXXXX” # Replace with your actual token ID
tsl = Tradehull(client_code, token_id) # Initialize the Tradehull client
print(“-----Login Successful into Dhan-----”) # Log in and fetch instrument file
pdb.set_trace()
orderid1 = tsl.order_placement(‘NIFTY 09 JAN 24500 CALL’,‘NFO’,75, 0, 0, ‘MARKET’,‘BUY’,‘MIS’)
Hi @Dipak_Patil
Good Question,
when the code runs, it reads the all_instrument xxxx-xx-xx file inside the Dependencies folder and starts all the necessary variables needed for trading.
when we stop the code by pdb, the program variables have already been initialized and program is just is standby mode, thus it fires order immediately.
let me know in detail what algo you wish to build, and send the complete code that you have created till now. then we can have it optimized so that it fires orders immediately
@Tradehull_Imran dear sir,
I am scalper I wanted algo just for entry and exit purpose. Now I have 3 files 1)login 2)for buy. When my setup is forming I am hit “Enter” manually.3)for sell or exit same order, here is also same action.
Now, I am reducing time 15 sec. To 3 orb 4 sec.using this files and process. Also I want reduced this time.
As per my research, if I want immediate action for order placements my strategy is define in code then it will possible.
But problem is that I am taking decisions based on price action. When I enter and when not.
I know it is possible to add my strategy in code. But at the initial level and required knowledge and required time I am not able to do this.
So. Any solution available based on my three files. And as per my concern, how can I reduced this 3, to 4 sec time delay???
1] Login file
import pickle
import os
from Dhan_Tradehull import Tradehull
client_code = “XXXXXXX”
token_id = “XXXXXXX”
tsl = Tradehull(client_code, token_id)
session_file = ‘session.pkl’
if not os.path.exists(session_file):
with open(session_file, ‘wb’) as file:
pickle.dump(tsl, file)
print(“Login successful, session saved.”)
2] Buy file
import pickle
import os # Add this import to fix the error
from Dhan_Tradehull import Tradehull
session_file = ‘session.pkl’
if not os.path.exists(session_file):
print(“Session file not found. Please run the login process first.”)
exit()
with open(session_file, ‘rb’) as file:
tsl = pickle.load(file)
orderid1 = tsl.order_placement(‘NIFTY 02 JAN 24400 CALL’, ‘NFO’, 49500, 0, 0, ‘MARKET’, ‘BUY’, ‘MIS’)
print(f"Order placed with Order ID: {orderid1}")
3] sell file
import pickle
import os # Add this import to fix the error
from Dhan_Tradehull import Tradehull
session_file = ‘session.pkl’
if not os.path.exists(session_file):
print(“Session file not found. Please run the login process first.”)
exit()
with open(session_file, ‘rb’) as file:
tsl = pickle.load(file)
orderid1 = tsl.order_placement(‘NIFTY 02 JAN 24400 CALL’, ‘NFO’, 49500, 0, 0, ‘MARKET’, ‘SELL’, ‘MIS’)
print(f"Order placed with Order ID: {orderid1}")