How to Construct JSON for Simultaneous Buy and Sell Signals in TradersPost

Fact checked by
Mike Christensen, CFOA
November 25, 2024
Learn how to construct JSON for simultaneous buy and sell signals in TradersPost and optimize your strategy using TradingView alerts or Pine Script.

Traders often encounter scenarios where they need to send simultaneous buy and sell signals for different stocks. For example, closing a position in one ticker while opening a position in another. This guide explains how to construct JSON alerts for such cases in TradingView and how TradersPost processes them for seamless execution.

Key Concept: Separate Alerts for Each Ticker

TradersPost requires separate alerts for each ticker, even if the actions need to occur simultaneously. For example:

  • Ticker A (Sell Signal): Close an open position.
  • Ticker B (Buy Signal): Open a new position.

Steps to Set Up Alerts

1. Create Alerts in TradingView

You’ll need to create two distinct alerts, one for each ticker.

  1. Open the chart for Ticker A (e.g., TQQQ) and set up a sell alert:
  2. {
       "ticker": "TQQQ",
       "action": "sell"
    }
  3. Open the chart for Ticker B (e.g., SQQQ) and set up a buy alert:
  4. {
       "ticker": "SQQQ",
       "action": "buy"
    }

2. Trigger Alerts Simultaneously

Both alerts will trigger at the same time if your TradingView strategy aligns the conditions for both signals concurrently. TradersPost will receive and execute both alerts simultaneously.

Using Indicators Instead of Strategies

For faster signal responsiveness:

  • Convert your Pine Script strategy to an indicator with alert() calls.
  • This approach avoids order constraints tied to strategies (e.g., waiting for candle close).

Benefits of Using Indicators:

  • Faster signal triggering.
  • Greater flexibility for sending custom alerts.
  • Simpler integration with TradersPost.

Key Takeaways

  1. Separate Alerts Required: Each ticker must have its own alert for buy or sell actions.
  2. Simultaneous Execution Supported: TradersPost processes alerts concurrently if received at the same time.
  3. Pine Script Pairing: Use programmatic alerts for precise control over simultaneous signals.
  4. Indicator Conversion: Consider using indicators for faster signal response.

Conclusion

Constructing JSON for simultaneous buy and sell signals in TradersPost is straightforward with separate alerts for each ticker. By leveraging TradingView’s alert system or custom Pine Script configurations, you can ensure seamless execution of complex trading strategies. With TradersPost’s robust platform, your signals are processed efficiently, enabling precise and timely trading actions.

Ready to automate your trading? Try a free 7-day account:
Try it for free ->