Order placement - Error

@Dhan_Cares @PravinJ @Naman

I had a basket order set to be triggered via tradingview webhook. The TV alert fired and basket got triggered for execution. But the sell order for 18400 put failed.

As you see the 17700 put short leg was exited first. Therefore no hedge break risk for 18400 exists at that point and order for 18400 put should have gone through but it didn’t.

Now I have to hold 18400 put overnight which I did not intend to do. Please avoid these kind of issues.

3 Likes

@PravinJ @Dhan_Cares @Naman

Thoughts ? The same error also happened with my fellow traders. We don’t want to run into same issue again. We need assurance from Dhan on this.

1 Like

Hi @t7support

We are having this checked with our concern team and will update you soon.

I had same issue. The sell order for put didn’t executed showing an error for hedge risk.

Hey @t7support ,

Very critical issue…

Have you ever experienced such issues on any other broker platform?

1 Like

No never faced such an issue with any other broker. But we have to note that only Dhan provides hedge break alerts along with order placement via tradingview webhooks.

1 Like

It shouldn’t matter, since it should be an extension of the same functionality via API I suppose.

Yes the bug is in hedge break alerts.

@Dhan_Cares @PravinJ @Naman pls disable this feature until the bug is fixed. The error happened today also. This bug is hampering our trading experience with Dhan.

1 Like

I agree on this. Yes ,you have a fantastic dev team and customer support, but when customer’s penny is involved, you should be doubly sure of the features you are releasing, pass thorough regression testing.

2 Likes

@Dhan_Cares @PravinJ @Naman @Hardik

This happened again today.

Pls pls fix this

hi @t7support

This isn’t a bug, we have mentioned it here - it’s alert when you are trying to exit a position on which you have a hedge benefit.

More on these alerts here: Update for Option Traders: Introducing Alerts on Breaking Hedge while Trading on Options on Dhan

Earlier when traders broke this hedge, there was a penalty that was being passed on to clients. Exchanges / Regulators have now prohibited brokers to pass on the penalty to clients - so if you exit, the penalty will still be there and Dhan will have to pay it. Hence to avoid such situations, we have introduced this alerts.

@PravinJ This is a bug !!!

Last week I had sold 18900 call and bought 18300 call. Today from the basket order I first bought back 18900 call. Then tried to sell 18300 call. There is no hedge break scenario here.

Please fix this error.

2 Likes

It seems Dhan backend is not recognising the non existence of the short leg with in the milli second delay the next exit order of the long leg is placed when fired via the basket order.

2 Likes

This bug essentially means we cannot exit hedged positions via basket orders directly or via TV webhooks. Please disable this new feature until the bug is fixed or fix it ASAP.

1 Like

@PravinJ @Dhan_Cares @Naman @Hardik

The error happened again today.

How are the orders sent out when a basket is executed via tv webhook ? Is it in sequential top down order as set in basket ? Is it that all orders in basket are sent to exchanges in one go and so there is a likelihood of the order queue changing (different from the set basket)

2 Likes

Dear Dhan, I have already pointed this in a different context at the thread
“Yes Pj and Naman… Please give the user a way such that if the 1st leg is successful then execute the second leg so on as so forth . In this way we can avoid margin issue. Also, if you can allow drag and drop strike prices as per user preference is his order of preference that would be great”

At least implement this for market order. though limit orders in basket order may be an an bit complex in implementation

The full thread is given below
https://community.dhan.co/t/basket-order-window-refinements/3418

Hi @t7support

We have gone through your order logs and found out few things. This is a rare phenomenon and can happen with anyone. There is little control of broker in this. Here is the explanation:

Let us first understand the execution of Basket Order. The basket order is placed in the same sequence as arranged in the basket. You will get the hedge benefit upfront (or the overall margin will be same as shown in basket) only when the sequence of execution of orders is followed. There may be a case when your first order (say Buy market order for options) is placed first but didn’t execute or executed lately for some reason. And then second order ( say Sell market order for options) is placed. Since the Buy order is not executed, so your Sell order may reject if there is insufficient funds. The reason for non-execution or delayed execution of Buy market order can be anything : Low liquidity or MPP on options so market order is converted to limit order or delayed response from exchange etc…

Next let us understand the concept of “Hedge Break Alert”. In the above case, if all orders are successfully executed, you will get upfront hedge benefit, hence lower margin requirement to execute option strategy. Point to note, the Sell leg (short position) is hedged by the Buy leg (long position). The standalone short position has higher margin requirement than with a hedge. So if you try to exit long position first, then you must maintain sufficient margin to sustain standalone short position or exit the short position first. If this is not followed, our system will alert you about the Hedge Break and will not let you exit the strategy to avoid any margin shortfall.

Now in your case, you are doing it correct with basket order. Exiting the short open position first (with Buy order of 18050 PE) and then long open position (with Sell order of 18600 PE). But for some reason (it may be any as mentioned above but non exhaustive) your Buy order of 18050 PE is not executed before the Sell order of 18600 PE is placed, hence you got a hedge break alert message. All this happened in fraction of second. Though after few millisecond the Buy order of 18050PE is successfully executed as it was placed earlier. Later when you manually exited 18600 PE it went successfully.

Trust me, all this happened in fraction of seconds.

This is very rare, and cant be controlled. The only suggestion from my side will be to avoid trading in illiquid contracts or try placing order manually. Even if you are automating your system, make a rule to place next order only when you have a confirmation of successful execution of first.

Hope this helps!

1 Like

yes this happened sometimes. but experience is fantastic with @Dhan

Not at all rare. All my and fellow trader orders triggered since Dhan brought in hedge break alerts have failed.

As far as I know exchanges process the orders on a FIFO basis. The first order has to be executed before the next order in queue is executed. All of these are market orders and hence should have gone through at the best price available as I set the basket order correctly.

I trade on liquid options. All the sell and buy legs have sufficient liquidity. If hedge break system at your end is waiting for the first sell leg exit confirmation and it is delayed for whatever reason and it causes an order failure at customer end its not a good system to have as is. May be Dhan can wait for few seconds. If the user doesn’t have sufficient margin still you can raise alert or auto square off the position. Either of these is better than an order failure.

I understand. Execution happens at nano second intervals these days. But order confirmation processing at your end this fast and before the next order is fired ? Please don’t penalize the customer via order failures because of the new system you guys brought in.

Can be controlled. Please go through my above suggestions.

I switched to Dhan to autotrade via tradingview webhooks.

Dhan can do the same with detected hedged orders too and it would be universal to all clients rather than cancelling the orders. Currently Dhan doesn’t allow option trading via TV webhooks nor have released basket order APIs limiting my ability to so.

2 Likes

We will check this if required, but here is stating how things are
a. We cannot (as broker) decided which leg / order of the trade to send to exchange first and next. Brokers do not have right to do order matching or prioritising this, it has to happen on exchange.
b. Total alerts generated for hedge break happened with <0.3% users y’day, and these are all alerts for hedge breaking, everything put together, including the one we refer to.
c. We have observed platforms add a validation layer before orders sent to exchanges in their own middleware (for whatever reason they had) - we can’t do that. Only checks are in order and risk management systems (oms & rms), where only criteria set there for order execution and risk management has to be checked.
d. platforms like ours are pure execution platform. anything if we change here, makes it an algo and it requires certifications.
e. with respect to the new alerting system, the background is brokers were forced to bring the new system as result of regulations. Many brokers made representations for same to reconsider. we ended up refunding penalties (in lacs) for no reason - but just to comply with regulations.
f. we are actually raising alert as suggested by you - we can’t auto square off as well unless it meets the merits as per the risk management policy. again, broker cannot make a trade on behalf of user.

I will still have our teams to check if there can be any solutions for this. I completely get this from your perspective - and I really hoped regulations also considered these scenarios.

1 Like