Reverse Trade upon Stop Loss Hit

Hello, I couldn’t execute reverse trade upon stop loss. I have provided the below 2 commands in the Tradingview alert message. But immediately it executes both Buy order and sell stop order and it exits the Buy order immediately then Sell stop was active.

1 BTCUSDm q=0.01 sl=0.4% td=1% ts=0.5%
-1 BTCUSDm q=0.01 p= -0.4% sl=0.3% td=0.5% ts=0.3%

How can I achieve this feature? Any help would be highly appreciated.

Thanks.

Hello @pravatkc

There are two mistakes in your commands;

  • Mistake 1: Extra space in the parameter: p= -0.4%:x: Incorrect
  • Mistake 2: Using a Sell Stop instead of a Sell Limit to catch a reversal after the SL is hit.

Correct Command Example

If you’re setting up a Sell Limit as a backup in case your long SL hits:

-1 BTCUSDm q=0.01 p=0.4% sl=0.3% td=0.5% ts=0.3%

:white_check_mark: p=0.4% – No space between the parameter and the value.
:white_check_mark: Using a Sell Limit, which is appropriate for entering a short when the price moves up to a certain level after hitting SL.


:bulb: Pro Tip

Always double-check your parameter formatting in the Automation Guide available under your Webhook Details section:

  • No spaces between param=value
  • Choose the correct order type (limit vs stop) based on your strategy logic.

Let me know if you’d like more help.

Tash!

1 Like

Thanks Tash for your response.

But due to some reason these 2 commands in alert message seems to be not working.
-1 BTCUSDm q=0.01 sl=0.4% tp=0.6% td=0.5% ts=0.35%
1 BTCUSDm q=0.01 p=0.4% sl=0.3% tp=0.5% td=0.5% ts=0.3%

When there is a sell alert these 2 commands executes… But the Sell trade exits immediately. And Buy limit was placed. this happens the same for Buy trade as well.

Thanks in advance. Appreciate your help.

Any idea what’s the issue here?


I used the same commands and they are working.

The Buy Stop is placed a little different from the SL becuase of spreads.

The sell trade could only exit immediately if there is high volatility and eother the tp/sl is triggered very fast.

Based on the screenshot, indeed it worked. But for me it was every time Buy or Sell exits immediately. where as, Buy Stop and sell Stop executed and remain active. Is there any issues with the Broker ? I use Exness. May be I will try again with bigger SL gap.

Thank you for your response and clarification, Tash. Much appreciated. If this issue solved, then it would be really good.

Try again with a bigger SL margin.

The trade history will also let you know if it is an issue with a too big spread.