Hi @Ushnota @MohitGolecha @Anand_Sajankar @Ketan @Pradeep_Jaiswar @Samit
I placed a MULTIPLE GTT order through the API (GTT ID: GTT-C25281100110631) and received a successful response with the GTT order ID. So I assumed that all three legs (Entry, Target, and Stoploss) were created correctly.
However, the actual behavior after execution was incorrect and resulted in an unexpected loss. Below is the exact sequence of events:
1. Entry leg worked correctly
The ENTRY leg was successfully created and executed (order_id: 251128000107733).
2. The Stoploss leg did NOT appear in the Upstox app
Only the TARGET leg was visible in the app.
The STOPLOSS leg did not show at all, even though I submitted it clearly in the API request body.
3. After the entry executed, the trailing stoploss
did NOT activate
The price moved up significantly, but my stoploss never moved upward with it.
The stoploss remained fixed at the original value that I sent in the API, instead of trailing with the market.
This caused the stoploss to trigger at the fixed level, and the trade closed at a loss.
4. After the trade closed, Fetch GTT API showed the following:
-
STOPLOSS: INACTIVE, order_id = null
-
TARGET: CANCELLED, order_id = null
-
Only ENTRY shows COMPLETED
This clearly means that the system never created the STOPLOSS and TARGET legs after the entry order filled.
As a result, the trailing mechanism never started, the stoploss did not move, and the position remained unprotected.
My questions (please clarify these clearly):
1. Why did the STOPLOSS leg remain INACTIVE with no order_id, even though the API returned a successful GTT creation response?
2. Why did the TARGET leg get CANCELLED automatically without ever being created?
3. Why did the trailing stoploss not activate even though the price moved upward after entry?
4. Why did the Upstox app show only the Target leg and completely hide the Stoploss leg?
5. What was the exact internal rejection reason when your system attempted to create the STOPLOSS/TARGET orders after the entry filled?
(Freeze range, tick size, MPP, margin, or instrument restrictions?)
Important clarification needed about how Trailing Stoploss works in Upstox
Please also clarify exactly how trailing stoploss is calculated in your system:
Is the stoploss supposed to be:
-
Current Market Price – trailing_gap?
(For example: if CMP = 510 and trailing_gap = 2.5, then SL becomes 507.5)
OR
- Should the stoploss only move upward as the market goes up, without ever moving downward again?
I need confirmation on the exact trailing logic Upstox uses, so I can apply it correctly in my automated trading system.
Summary
-
API placement returned success
-
STOPLOSS leg never created
-
TARGET leg cancelled
-
Trailing stoploss did not activate
-
Trade closed at the fixed SL, not the trailed SL
-
Fetch API confirmed both protective legs were never spawned
This left the position unprotected and caused a loss.
Please investigate this issue and share the detailed internal reason why the protective legs (STOPLOSS and TARGET) were not created after entry execution.
Thank you,
Ayush
