Thanks for reaching out!
We already have a feature called Conditional Trigger Basket that addresses a similar use case to the one you’ve described.
You can refer to the detailed post below to understand how the feature works and how you can use it to achieve your requirement.
https://madefortrade.in/t/all-new-baskets-on-dhan-introducing-basket-orders-with-conditional-triggers-basket-sip-1-by-1-execution/94188?u=naman