📈
TradingView Alert Connector Tutorial
  • Overview
  • TradingView Introduction
  • Prerequisites
  • Set Up
    • Get your keys
    • Create your connector
  • FAQ
Powered by GitBook
On this page
  1. Set Up

Create your connector

PreviousGet your keysNextFAQ

Last updated 2 years ago

1.Refer the codes in github to install first

git clone https://github.com/cj2094/apexpro-tradingview-connect
cd apexpro-tradingview-connect

2.Input the values you got from ApeX Pro (your credentials) in the previous Chapter (Get your keys) to .env file.

Required variables for ApeX Pro

ETH_ADDRESS=

STARK_PUBLIC_KEY=

STARK_PRIVATE_KEY=

API_KEY=

API_PASSPHRASE=

API_SECRET=

ACCOUNT_ID=

Optional Variables

TRADINGVIEW_PASSPHRASE=

SENTRY_DNS=

3.Install ngrok, sign up, and add authtoken with the following guide npm install --force

We use ngrok to get public URL and tunnel to your localhost to receive webhook from Tradingview

Open a new terminal window and start ngrok

yarn ngrok

Open a new cmd,and excute

./ngrok http 3000

Look for "Forwarding https://xxxxx.ap.ngrok.io -> http://localhost:3000"

If you see a status message of your set up on your browser, the server is running properly.

5.On the Tradingview website, select BINANCE:BTCPERP(or other ticker your want) and set the time interval to 1 minute.

6.Open "Pine Editor" tab and paste the following script after deleting shown original script. Then click "Add to chart"

//@version=5
strategy("My test strategy")

_TestPeriod() =>
    time >= timenow - 10000000 ? true : false
    
if _TestPeriod()
    if (bar_index % 2 == 0)
        strategy.entry("My Long Entry Id", strategy.long)
    else
        strategy.entry("My Short Entry Id", strategy.short)

7. Click Alert button

Paste the following script to Message(Note: Your passphrase needs to be same with the API_PASSPHRASE in .env.)

{
"exchange": "dydx",
"strategy":"testStrategy",
"market":"BTC_USD",
"size":"0.001",
"reverse":false,
"order":"{{strategy.order.action}}",
"position":"{{strategy.market_position}}",
"price":"{{strategy.order.price}}"
}

8.Input your webhook url (sth like https://xxxxx.ap.ngrok.io) and click "Create"

This alert is triggered every minute and creates a buy/sell order alternately.

Open your browser and access Forwarding HTTPS URL which showed in the console sth like (Note: You can ignore security alerts from Chrome browser.)

4.Login

https://xxxxx.ap.ngrok.io
TradingView – Track All Markets
LogoGitHub - cj2094/apexpro-tradingview-connectGitHub
Logongrok - download