READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

How to implement “Stop & Reverse on Stop Loss hit” in SQX AlgoWizard

1 replies

Philip

Subscriber, bbp_participant, 1 replies.

Visit profile

5 months ago #293127

Hi StrategyQuant X Support Team,

I’m building a strategy in SQX AlgoWizard (H1 mean-reversion). I’d like to implement Stop-and-Reverse (SAR) logic:

  • If the last closed trade was closed by Stop Loss, then on the next bar open I want to open an opposite position (reverse direction).
  • Example: If a Long trade is stopped out by SL → immediately (or next bar) open Short. If a Short trade is stopped out → open Long.

I can find the following blocks in AlgoWizard:

  • Closed P/L (in pips) (last closed trade P/L)
  • Bars Since Order Closed
  • Order Stop Loss (SL price level)
  • Order Open Price (open price level)
  • “Last Order Was …” blocks (direction filters)

However, I cannot find a direct condition like:

  • “Last trade closed by Stop Loss” / “Exit reason = SL” / “Order closed due to SL”

Could you please advise:

  1. Is there a built-in block (or recommended approach) to detect that a closed trade was closed specifically by Stop Loss, not by other exit logic (time exit / indicator exit)?
  2. If there is no direct “exit reason” block, what is the official recommended workaround in SQX?
    For example, can we reliably compare:

    • last trade close price vs stop loss price, or
    • last trade loss in pips vs expected SL distance (from Order Open Price and Order Stop Loss)?
  3. What is the best practice to avoid repeated triggers (e.g., using Bars Since Order Closed) so the reverse order is placed only once?
  4. When implementing SAR, should the reverse order reuse the same SL/exit rules, or do you recommend a separate TP/SL setup for the reverse position?

If helpful, I can share screenshots of the blocks I see in AlgoWizard and my current strategy structure.

Thanks in advance

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

5 months ago #293158

Hi,

simply use a condition that includes the ‘Closed PnL’ function together with the ‘Last order was (Long/Short)’

When identified by a magic number you will have a clear idea how the last trade ended

0

Viewing 1 replies (of 1 total)