The problem of trailing stoploss still seems to exists. I place around 200+ orders with trailing stoploss and stoploss.
But, trailing stoploss worked only for 1 order and for remaining orders, it didnt. Stoploss values is not changing for the remaining one.
Trailing stoploss is one of the most important need for my strategies to work out. Here is one order Id for you to debug into BO order id: 161122000024857
And the order id for which it worked is 161122000024864
Below is the Url that was hit to place the above order. Similarly, all 200+ orders were sent using the same structure with different targets and stoploss. Request Data: api_key=********&access_token=****************************&tradingsymbol=HDFCBANK&exchange=NSE&transaction_type=SELL&order_type=LIMIT&quantity=1&price=1202.8&squareoff_value=28.15&stoploss_value=5.95&trailing_stoploss=7&product=MIS&validity=DAY&tag=OHOLBASK\ Response Data: {"status": "success", "data": {"order_id": "161122000024864"}}
I know that much basic that if position is in loss, the trailing stoploss does not come into picture.
As per the bracket order and trailing SL concept, if the prices move in your trade direction, then the stoploss also keeps moving.
My HDFC BANK was sold between 1198 to 1203. Check todays intraday charts for HDFCBank. It went from 1203 to 1189.35. and my trailing stoploss was somewhere between 2.5 - 7 rs for different order. So, when the price of stock went below 1203 untill 1189.35, the stoploss should have also get changed to new lows. But it didnt. All the stoploss remained at the same price.
I have been using Kite connect API since day one. So, I know all its basic details. This issue has already been discussed with Kailash & Vivek 2 months before. They have already escalated this to OMensys.
I was under impression, that it has been resolved by now. And it did worked for one of the orders today, but for remaining 200+ orders, trailing stoploss didnt worked. Thats what i wanted to bring to your notice so that it can be looked into.
Hope this helps to do your further debugging. Thanks, Sourabh.
Hi Sourabh, Can you give particular order's parent order id, stoploss and target order id for which you think stoploss trailing didn't work? We will check and get back to you.
There are several orders. I am just sharing one order details for simplicity Reference numbers:
BO Order ID: 161122000024855 Child SL order ID: 161122000045885
Request sent to zerodha using below url api_key=********&access_token=********&tradingsymbol=HDFCBANK&exchange=NSE&transaction_type=SELL&order_type=LIMIT&quantity=1&price=1198.9&squareoff_value=26.6&stoploss_value=9.85&trailing_stoploss=6.65&product=MIS&validity=DAY&tag=OHOLBASK Response: Response Data: {"status": "success", "data": {"order_id": "161122000024855"}}
Order Execution Time : 9:30:05
Hdfc Bank made a low of 1189.35. (at 10:50 am).
Now, when first trade was done, initial SL was placed at 1198.9+9.85 = 1208.75. price fell by trailing stoploss amount (i.e 6.65). So, SL should get changed to 1208.75-6.65 = 1202.1 But the SL never got changed from 1208.75 for the full day.
@pivottrading.net We have identified the issue and it was caused when you send non integer value for stoploss. We have fixed this in our production version and you should be able to use it. Though we found few issues related OMS which throws invalid tick size for some values which we are in talks with them to get it fixed.
Positions you are referring to are all in loss, So trialling will never come into picture. Checkout this to know more about bracket order http://zerodha.com/z-connect/tradezerodha/zerodha-trader-software-version/bracket-orders-trailing-stoploss-sl
I know that much basic that if position is in loss, the trailing stoploss does not come into picture.
As per the bracket order and trailing SL concept, if the prices move in your trade direction, then the stoploss also keeps moving.
My HDFC BANK was sold between 1198 to 1203. Check todays intraday charts for HDFCBank. It went from 1203 to 1189.35. and my trailing stoploss was somewhere between 2.5 - 7 rs for different order. So, when the price of stock went below 1203 untill 1189.35, the stoploss should have also get changed to new lows. But it didnt. All the stoploss remained at the same price.
I have been using Kite connect API since day one. So, I know all its basic details. This issue has already been discussed with Kailash & Vivek 2 months before. They have already escalated this to OMensys.
I was under impression, that it has been resolved by now. And it did worked for one of the orders today, but for remaining 200+ orders, trailing stoploss didnt worked. Thats what i wanted to bring to your notice so that it can be looked into.
Hope this helps to do your further debugging.
Thanks,
Sourabh.
Can you give particular order's parent order id, stoploss and target order id for which you think stoploss trailing didn't work? We will check and get back to you.
There are several orders. I am just sharing one order details for simplicity
Reference numbers:
BO Order ID: 161122000024855
Child SL order ID: 161122000045885
Request sent to zerodha using below url
api_key=********&access_token=********&tradingsymbol=HDFCBANK&exchange=NSE&transaction_type=SELL&order_type=LIMIT&quantity=1&price=1198.9&squareoff_value=26.6&stoploss_value=9.85&trailing_stoploss=6.65&product=MIS&validity=DAY&tag=OHOLBASK
Response:
Response Data: {"status": "success", "data": {"order_id": "161122000024855"}}
Order Execution Time : 9:30:05
Hdfc Bank made a low of 1189.35. (at 10:50 am).
Now, when first trade was done, initial SL was placed at 1198.9+9.85 = 1208.75.
price fell by trailing stoploss amount (i.e 6.65). So, SL should get changed to 1208.75-6.65 = 1202.1
But the SL never got changed from 1208.75 for the full day.
Hope this will help to debug.
Thanks,
Sourabh.
Great to know that it has been fixed. Will run my algo again tommorow.
Please confirm my above understanding.
You are right. Decimal values passed in stoploss was creating problem. Give it a try and let us know.
This wa working fine in the morning.
The minimum value for trailing stop-loss is 1.
You can give decimal value for trailing stop-loss but it has to be multiple of tick size.
Got it. Regarding tick am okay as I take care of it at my code level before I send any price or related value to Zerodha
You mean in relative value like the way target and stop loss is correct ?