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 alert-condition

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 symbol/chart

Open your symbol on a TradingView chart. Select the required time-frame and place the new script on the chart. You can use the pre-build script down below and can link it to your favorite indicators.

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 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

Note down that key as you need to enter it when you setup the webhook connection in the next step.

4. Activate the webhook

The "Create Alert" function from TradingView will activate the webhook on their servers for your symbol and timeframe.

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.