Unable to place stop loss order
-
Hi,
I am unable to place stop loss order, can someone please help ? Below is the order parameters I am trying with -
OrderParams orderParams = new OrderParams();
orderParams.variety = "STOPLOSS";
orderParams.quantity = 1;
orderParams.symboltoken = "3045";
orderParams.exchange = Constants.EXCHANGE_NSE;
orderParams.ordertype = Constants.ORDER_TYPE_SL;
orderParams.stoploss = "362";
orderParams.tradingsymbol = "SBIN-EQ";
orderParams.producttype = Constants.PRODUCT_INTRADAY;
orderParams.duration = Constants.VALIDITY_DAY;
orderParams.transactiontype = Constants.TRANSACTION_TYPE_BUY;
orderParams.price = (double) 362;
orderParams.squareoff = "0";Order order = smartConnect.placeOrder(orderParams, Constants.VARIETY_REGULAR);
-
Hi @bhushan please post your error here also check your stoploss and price.
-
@admin not getting any errors. I tried with multiple combination but unable to place stop loss order. Limit orders are fine. And I am unable to find trigger price also in orderparams.
When I was checking this market was at 358 range and I wanted to buy if the price moves above 362. I know I can place a limit order if the price matches my price, but I want to keep the order ready with trigger price.
-
Hi @bhushan we will get back to you on your issue it is noted.
-
hi @bhushan provide us with your client to further assist you.
-
@admin Appreciate your reply but I solved it by myself.
I made the following changes in source code and rebuilt the jar.
- in OrderParams.java I added the parameter triggerprice
public String triggerprice;
-in SmartConnect.java I added the trigger price in JSONObject params which will be sent via order post request
if (orderParams.triggerprice != null)
params.put("triggerprice", orderParams.triggerprice);- in Constants.java there was no option to set order type "STOPLOSS_LIMIT" and variety "STOPLOSS" so I am using them as direct string in my program.
Now I am able to place stoploss order and I can also use triggerprice along with the order
- in OrderParams.java I added the parameter triggerprice
-
@bhushan
Thanks for the workaround! -
HI @vvbchandrasekhar @bhushan The above issue is solved you can check now and try to execute order.
-
This post is deleted! -
@admin Hello admin,
Please update the JAVA jar file to include trigger price while placing an order.
-
Hi @theVishal we have noted this we will update you on this.
-
@admin said in Unable to place stop loss order:
HI @vvbchandrasekhar @bhushan The above issue is solved you can check now and try to execute order.
thanks. ichecked the changelog on https://github.com/angelbroking-github/smartapi-java/commit/8edfe8819c92aeb770de473a27a26362d1812b45
However, can you release the change to dist (jar file)?
-
Hi @vvbchandrasekhar ok.
-
@bhushan said in Unable to place stop loss order:
Hi,
I am unable to place stop loss order, can someone please help ? Below is the order parameters I am trying with -
OrderParams orderParams = new OrderParams();
orderParams.variety = "STOPLOSS";
orderParams.quantity = 1;
orderParams.symboltoken = "3045";
orderParams.exchange = Constants.EXCHANGE_NSE;
orderParams.ordertype = Constants.ORDER_TYPE_SL;
orderParams.stoploss = "362";
orderParams.tradingsymbol = "SBIN-EQ";
orderParams.producttype = Constants.PRODUCT_INTRADAY;
orderParams.duration = Constants.VALIDITY_DAY;
orderParams.transactiontype = Constants.TRANSACTION_TYPE_BUY;
orderParams.price = (double) 362;
orderParams.squareoff = "0";Hi @bhushan @theVishal @vvbchandrasekhar this is updated you can check and revert back.