Need Input on Coding Logic - Which approach is better ?

shahbinoys21
Hi,

I had my code prepaid from a developer in python. I have a basic knowledge of coding. I am confused between 2 approaches to placing orders in the system. I am retrieving the data via Websockets of all FNO stocks.

Code Logic - Once a particular 5 min candle low/high breaks, order needs to be placed in the system

Current Approach.

- Waiting for low of the candle to be broken and then place a limit order in the system, based on bid ask spread

limit_price = fix_values(ltp + min(2*new_order['Bidask_spread'],.0025*ltp),new_order['tick_size'])

def fix_values(value,tick_size_stock):
return round(int(value / tick_size_stock) *tick_size_stock,len(str(tick_size_stock)))

Problem

- Many orders are getting skipped, and are not getting executed.

Solution

- For sell trades, Once the 5 min candle is formed, place a sell SL order in the system before the low is broken.

Now the person who has written the code says that the solution won't make much difference as both Limit & SL orders execution time will be the same. I want the experts on the forum to confirm, whether the 2nd approach of placing the sell sl order already in the system would be beneficial or not.
Sign In or Register to comment.