Câu hỏi thường gặp | Binance FAQ
Bài viết này không hỗ trợ ngôn ngữ của bạn. Bạn nên dùng bộ dịch tự động sang tiếng Anh.
Trang chủ
Trung tâm trợ giúp
Câu hỏi thường gặp | Binance FAQ
Phái sinh tiền mã hoá
Hợp đồng tương lai
Hướng dẫn Futures
How to Set Up Customized Indicators and Backtest Your Strategy on Binance Futures

How to Set Up Customized Indicators and Backtest Your Strategy on Binance Futures

2023-01-12 11:17

What are customized indicators?

Binance provides a wide range of technical indicators for Futures traders. The new customized indicators include user-specific variables that let users adjust key inputs to accommodate their trading strategy needs.
You can enter your own parameters or customize the existing parameters on the trading chart, such as Moving Average, Bollinger Bands, Volume Weighted Average Price, etc. You may refer to this Academy article to learn more about technical indicators.

How does the backtesting function work with customized indicators?

Although past performance can never guarantee future results, backtesting a script allows traders to estimate how efficient it is to pick signals and anticipate how a related strategy can perform in the future.
Binance’s backtesting function allows you to run your customized strategy (based on existing or customized technical indicators) within a given period in the past and test its performance against the market conditions across that period. Please note that the backtesting function currently only supports USDⓈ-M Futures, the Cross Margin mode, and the Multi-Assets mode.

How to set and visualize customized indicators?

1. Log in to your Binance account and go to [Derivatives] - [Binance Futures Overview]. Choose either [USDⓈ-M Futures] or [COIN-M Futures].
2. Select a symbol (e.g., BTCUSDT) and click the [Technical Indicator] icon on top of the trading chart.
3. You will see the [Indicator] pop-up. Under the [Main] tab, you can choose the preset indicators, such as MA, EMA, WMA, Bollinger, etc., and click [Save].
4. To customize your indicators, go to the [Customized] tab on the right. Click [Add].
5. You will see the customized indicator workspace, from where you can set up your own parameters and import or export your own scripts.

Example

Let’s take the RSI (Relative Strength Index, an indicator for measuring the price momentum of an asset) as an example to see how you can customize the indicators. The standard RSI is calculated over 14 periods (14 days timeframe). However, a shorter-period RSI is more reactive to recent price changes as it can show early signs of reversals.
Assuming that you want to apply a short 6 periods RSI (RSI 6) instead of the longer 14 periods RSI (RSI 14). To do so, you need to customize the RSI in order to apply your own parameters.
1. Click [New] and select [RSI Channel] from the drop-down menu.
2. The standard RSI source code will be displayed. Click [Add to chart] to display the indicator on the chart.
3. To change 14 periods (RSI 14) to 6 periods (RSI 6), replace the initial parameter (14) with the new parameter (6) in the corresponding code line (line 3):
Len = input(6,title = “Length”, type=”int”)
Click [Add to chart]. The new indicator will replace the former according to the parameter you entered
4. To save this new Indicator and display it on the Binance Futures trading interface, click [Save as] and enter a name. Click [Save].
5. You will be redirected back to the Binance Futures trading interface. Click the [Technical Indicators] icon again and go to [Customized]. You will see the new customized indicator you just saved. To display it on the chart, click on the indicator.
You can refer to the custom indicator documentation for a complete description of the parameters.

How to use the backtest function?

1. Log in to your Binance account and go to [Derivatives] - [Binance Futures Overview]. Choose [USDⓈ-M Futures].
2. Click the [Settings] icon and select [Backtest].

Example

Assuming you want to backtest a strategy based on Simple Moving Average (SMA). It is the average market price of a security over a specified period, plotted on a chart bar-by-bar and forms a line that moves along the chart as the average price changes.
Your strategy involves opening a BTCUSDT position daily (every 24 hours at 08:00):
  • Open a 0.1 BTC long position when BTCUSDT price is over the Moving Average (= buying a Futures contract above the average price);
  • Open a 0.1 BTC short position every time BTCUSDT price goes under the Moving Average (= shorting a Futures contract under its average price);
  • You take a ten-day Simple Moving Average (SMA) corresponding to the average price over a 10-day period, calculated by adding up the 10 most recent daily closing prices and dividing it by 5 to create a new average every day.
The corresponding code will be:
#@version = 1
strategy("SMA",overlay=True)
ma = sma(close,10)
plot(ma)
strategy.order(strategy.long, 0.1, when = open > close)
strategy.order(strategy.short, 0.1, when = open < close)
1. Go to the backtesting workspace from [Settings] - [Backtest].
2. On the [Strategy Editor] tab, enter the code of the strategy you want to backtest.
3. Go to the [Parameters Config] tab. Select the parameters of your strategy and click [Start Backtest].
Let’s assume you want to backtest this strategy over a 32-day period:
  • Time range: 2022-12-11 to 2023-1-11
  • Period: 1 day
  • Initial amount: 1,000 USDT
4. Your strategy will start to run. To check the result, go to the [Performance] tab. You can view the estimated profits, fees, Cumulative PNL (%), Annualized Interest Rate(%), and Maximum Drawdown Rate (%).
5. To view the trades executed for your strategy during the time range, go to the [List of Trades] tab.
7. You can zoom in on the chart to visualize the backtested strategy. Buy and short trades are displayed by green and red arrows respectively.
8. You can also save your customized strategies, so they can be easily accessed via the [Indicator] menu on the trading interface.