The reverse_order_close parameter controls how PickMyTrade handles existing positions when an alert signal is received in the opposite direction. This feature applies to both TradingView indicators and strategies, but with different defaults to avoid potential position mismatches.
1. How It Works #
Case 1 — Adding to a Position #
- Example: You have 1 Buy position.
- Alert Sent:
Buyorder for 1 unit. - Result: Position increases to 2 Buy.
- Explanation: Since the order is in the same direction, it adds to the position.
Case 2 — Opposite Order, reverse_order_close: false #
- Example: You have 1 Buy position.
- Alert Sent:
Sellorder for 1 unit,reverse_order_close = false. - Result: The existing Buy position is closed.
- Explanation: The system offsets the existing position without opening a new one in the opposite direction.
Case 3 — Opposite Order, reverse_order_close: true #
- Example: You have 1 Buy position.
- Alert Sent:
Sellorder for 1 unit,reverse_order_close = true. - Result:
- Existing Buy position is closed.
- A new Sell position is opened.
- Explanation: This setting reverses the position in a single step.
2. Applicability #
- Indicators → Fully supports both
reverse_order_close: trueandfalse. - Strategies → Supports both values, but defaults to
falseto avoid position mismatches.
3. Why Strategies Default to false #
- Strategies in TradingView often send orders on every bar based on backtesting logic.
- If
reverse_order_closeis set totrueby default, it can:- Rapidly flip positions in volatile markets.
- Cause position mismatch between PickMyTrade, your broker, and TradingView’s backtester.
- Setting it to
falseensures that an opposite signal simply closes the current position without automatically reversing.
4. Key Takeaways #
- Use
reverse_order_close: trueonly when you intentionally want immediate reversals. - For most strategies, keeping it
falseensures position tracking stays consistent. - For indicators, either option can be used depending on your trading style.