Skip to content

Step by step guide to live trading with TradingView

Rose Heart edited this page Sep 17, 2023 · 23 revisions

Step-by-step guide to live trading with TradingView

This wis a step by step demonstration of setting up TradingView with Jackrabbit Relay for live trading. Please be aware of the risks of live trading and have a properly vetted strategy with a plan for dealing with a worst case scenarion situation.

For the purposes of this example, I will be using Jackrabbit TV, a carefully crafted trading paradigm for TradingView that is accemulation based. I will specifically be using a recipe (combination) of MACD, Bollinger Bands, and AROON, coupled with DCA as the driving algorithm for buys and sells. I chose this particular recipe because it represents a nice balance between defensiveness and aggressiveness.

Plase be aware that these examples use TradingView macros. Please take note and time to familarize yourself with these macros as they are very useful in Pine Script deployment and profitability.

The walk through

The use of the DSR is ONLY for TradingView. You must have a symbol map file as outlined by the installation video.

In the /home/Jackrabbit2/Config/dsr.cfg file, I added the following,

{ "Framework":"virtual","Account":"bSpot","Webhook":"http://1.2.3.4:80" }

If you don't use a identity for each exchange, then you can reuse the same DSR account multiple times. Please pay particular attention as the framework is listed as virtual. The webhook IP address of 1.2.3.4 must be your VPS IP address. TradingView requires Relay run on port 80, if you don't have a web server already using port 80. If you do have a web server, then you will need to "tuck" Relay under it or use the RelayPassThru program to connect them together.

Below is a blank TradingView form for creating alerts. We are going to fill in each component.

TradingView alert form

Now to fill in the TradingView alert form. Lets start with condition.

The condition is what triggers the alert. In the case of Jackrabbit TV, the condition will be either Jackrabbit.modulus.Analyzer for strategies, or Jackrabbit.modulus.DCA for studies/indicators.

Once you have set the condit to a signal generating script, you will need to click on the box that has the word crossing in it. This will set the intended direction, either BUY ASSET or SELL ASSET, for Jackrabbit modules. If you are using other TradingView scripts that generate signals, this will not be much different. The script will provide instructions in its description. For our example, pick BUY ASSET.

Now you will be given options of how often to allow the alert. I recomend that all buys be ONCE PER BAR and all sells/close be ONCE PER MINUTE, unless the timeframe is less then 1 minute, then sell/close at ONCE PER BAR as well. This will maximize and priortize you sell signals to capture profit as opportunistically as possible.

If your expiration time allows for *OPN ENDED, put a check in that, otherwise select what is approprite to your TradingView subscription.

Checkmark the Webhook URL option and fill it in. The webhook url needs tp be http://1.2.3.4:80. Rember to replace the 1.2.3.4 with YOUR IP address.

While Alert Name is not neccessary, it should be used to help track your alerts. I find that putting the name of the exchange or asset with a shortened reference to my strategy to be helpful. For example, Binance ADAUSDT Buy MMBD, tells me that this alert is for the Binance exchange, trading ADA/USDT. It is a BUY alert using the Momentum/MACD/Bollingers Bands/DCA recipe. This is a reference I developed. You will need to develop an approach that works for you and is easy to keep track of.

Now we get to the hardest part of the form, that actual message body. This is where your alert message (payload) goes. Because we are using the TradingView remapping system of Relay, this will be a little easier, but there is still quite a bit of planning needed.

This message alert is specific to the DSR,

{
  "Time":"{{time}}",
  "Recipe":"#Momentum #MACD #BBands #DCA",
  "Action":"Buy",
  "Exchange":"dsr,kucoin",
  "Account":"bSpot,MAIN",
  "Market":"Spot",
  "Asset":"{{ticker}}",
  "RemapSymbol","Yes",
  "USD":"10",
  "Price":"{{close}}",
  "AvgProfit":"{{plot_0}}",
  "LProfit":"{{plot_1}}",
  "TCycles":"{{plot_2}}",
  "CBuys":"{{plot_3}}",
  "MBCycle":"{{plot_4}}",
  "TBuys":"{{plot_5}}",
  "Link":"https://www.tradingview.com/chart/lMQAJ6YU",
  "Identity":"YourIdentity"
}

There is quite a bit here that we ned to unpack. This payload can be confusing. Lets start with all of the elements that are surounded by curly braces, {{ }}. These are TradingView macros and they are filled in at the time the alert happens. The macros are a blessing and a really nice time saving feature, especially when you are using a program to generate 50 or more alerts trading the same recipe.

For this message, these macros pertains to specific details of th Jackrabbit DCA module and are REQUIRED to ensure proper function. Recipe can be anything you want, but it must be clear and concise. It is used by the system to track all trades associated with THIS strategy. I found using a hash tag (#) with each module (indicator) to work well for keeping clarity and easy tracking.

Link is not required, but I heavily encourage it as a diagnostics tool that gets logged with each trade. As your system grows, tracking situations is going to become tedious without these simple references to help make the task easier, especially is you are using many different strategy combinations.

After you hav checked all your work, click Create to make your first alert.

Sell and Close are identical to the above, with the exception of the action being Sell or Close.

TradingView Strategy Differences

TradingView strategies are really not much different. Thisis where the Jackrabbit Analyzer is used. There are only 2 differences that need to be done.

First, the action needs to become a TradingView macro, {{stratgy.order.action}}. This gets filled with either buy or sell. Compared to TradingView studies or indicators, strategies only need ONE alert to both buy and sell. This effectively doubles the number of active alerts you can have. With a premium subscription, this gives you the ability to trade upto 400 different assets.

The second difference specifically deal with how Relay closes a position from a strategy. The ONLY options for a strategy is buy or sell. Because of not actually being able to send a direct Close action, you wil need to use the fllowing element in either your exchange config or your order,

  "Action":"{{strategy.order.action}}",
  "CloseOnSell":"Yes",

This explicitly tells Relay to Close the position when TradingView sends a Sell action as well as sending the proper action your script requires.

Thats really it. At this point, you have the knowledge to begin (hopefully) making real money trading. Please be sure to read about conditional orders as that can significantly increase the number of usable alerts on TradingView by managing the selling for you.

RAPMD Crypto: Automated algorithmic trading done right

Jackrabbit support server

JSON Validator

Frequency Weighted OrderBook Analysis

Advanced Research

Introduction

Jackrabbit Relay
Introduction
Risks
Disclaimer
Notes
Video
Supported Exchanges/Brokers
Security and firewall
Installation
Updating
Configuration files
Live Trading


Installation-and-Setup

Installation/Setup
Requirements
Stopping Version 1
Installing and setting up Version 2
Configuration
Reboot startup
Manual startup


Identity

Identity


Configuration

Configuration
Configuration files
Location and file names
File contents
Order types
Examples for the CCXT framework
Examples for the OANDA framework


Orders

JackrabbitRelay Order Payloads
Payload Synopsis
Order Types
Actions
Examples


Conditional Orders

JackrabbitRelay Order Payloads
Oliver Twist: Jackrabbit Relay conditional and orphan order manager
Unveiling Oliver Twist's Conditional Methodology
Managing Orphan Orders: The Limit-Only Approach
The Literary Significance of "Oliver Twist"


Supported-Exchanges-and-Brokers

Supported Exchanges/Brokers
Forex Brokers
Confirmed working brokers
Cryptocurrency Exchanges
Confirmed working exchanges
Theoretically supported


Known-Issues

Known Issues
Closing a position fails
BitMex
Phemex
ByBit
Python 3.10
Kucoin Futures/TradingView


Virtual-Exchange-Broker-DSR

DSR (Duplicate Signal Remover)
Log Files


Jackrabbit-Mimic

Jackrabbit Mimic
Introduction
Usage
Data Source Integration
Simple Setup Process
Understanding Differences
Educational Focus
Setup and Configuration
Wallets and history
How cryptocurrency wallets work
Long positions
Short positions
Alert/Signal messages
Long positions
Short positions
Supporting Jackrabbit Mimic


Logs

Logs
Files
JackrabbitRelay
PlaceOrder


Testing-TradingView-connection

Testing TradingView connection
Testing method
Setup
DSR Testing
Force feeding payloads
Next Steps


Step-by-step guide to live trading with TradingView

Step-by-step guide to live trading with TradingView
Walk Through
Strategy Differences


Additional Programs

Additional Programs


Roadmap

Roadmap
Finished
In Progress
Future Plans


Supporting-Jackrabbit

Supporting Jackrabbit and it's future development
Current patrons and subscribers
The cost of open source
Supporting

Terms-and-Definitions

Terms and Definitions

Clone this wiki locally