Skip to main content

TradingView Integration

The integration provides a back-to-back integration between your TradingView charts and the cycle analysis toolset. Allowing to keep your TradingView chart data synced in real-time with the cycle analysis API and cycle application. Allowing to monitor active cycles in your TradingView chart for any symbol and timeframe.

The first step is to setup a separate alertcondition via a new pine script and attach it to your chart you want to use for cycle analysis.

1. Create a new individual alert-condition via a custom pine script

The simplest way of alert-condition for a pine script looks like this:

//@version=4
study("WTT_DataFeed")
plot(close)
alert = true

msg = "{\"streamid\":\"YOUR-STREAM-ID\", \"messagetype\":\"UPSERT\", \"dates\": [ \"{{time}}\" ], \"values\": [ {{close}} ] }"

alertcondition(alert, title='data', message=msg)

Be aware that the text string YOUR-STREAM-ID within the msg variable will be replaced later when you create the alert. This is just a new alert-condition we place on your chart. This is not the alert.

This basic version will use the [close]

2. Open your chart/time-frame and place the new script on the chart

Want to place this script on your TradingView chart? Just use this prepared script:
https://www.tradingview.com/script/FTEsZurP-Cycle-Analysis-WebHook-API-Integration/

3. Get your cycle analysis API key

Before we start the alert and connection, ensure you have your cycle analysis API key at hand. You will find your API key via the cycle application: https://cycle.tools/account/api

4. Activate the webhook via "Create Alert" from your chart

To start the live sync, the web-hook will be started via the alert activation from the TradingView alert panel. Ensure to select the right Condition and choose:

  • Condition: "WTT_DataFeed", data
  • Options: "Once Per Bar Close"
  • Expiration: Open-ended
  • Alert Actions: Webhook URL
  • Cycle Analysis webhook URL: https://api.cycle.tools/api/Stream/SubmitStreamData?api_key=YOUR-KEY
  • Message: Replace YOUR-STREAM-ID

TradingView Create Alert

Important: Before you create the alert, replace the YOUR-STREAM-ID tag in the Message section with the stream ID you want to see that in your cycle analysis platform. Also replace YOUR-KEY in the webhook URL with your cycle analysis API key.