Relative strength quantitative trading strategy based on price
Tags: strategy, fmzquant, trading, cryptocurrency
Published: 2024-05-17 05:29:19

### What is relative strength?
Relative strength is a momentum investment strategy that compares the performance of stocks, exchange-traded fund (ETF) or mutual funds with the performance of the overall market. By using specific calculations, investors can identify the strongest performer compared with the overall market and provide suggestions for investment. Relative strength assumes that the rising asset price will continue to rise, or at least extend its rising trajectory.

This feature is true in any transaction target, especially in digital currency. By quantifying the parameters of these rising factors, there is a reliable and large increase in returns.

### Specific relative strength
The relative strength creates a comparison point between the performance of specific trading targets and the performance of selected benchmarks (such as market indexes) and other similar trading targets. The relative strength strategy has both entry and exit; The purpose of investors using this technology is to buy the trading target with strong signs as soon as possible and sell the weak trading target they hold when the relevant trading target begins to appear weak. This investment strategy has its own comparative advantages, and it can also be applied to more complex strategies, such as paired trading.

### Use relative strength to guide investment decisions
Investors can use their comparative advantages to determine the best performer in the selected potential investment group. This allows the performance of each trading target to be compared with another trading target or selected benchmark index (such as a basket of mainstream digital currency indexes) directly. Traditionally, investors use relative strength to compare stocks to each other or to an index. Investors can only use relative strength to compare mutual funds according to the relevant net asset value (NAV) divided by the number of stocks. This couldn't be more appropriate when transferred to digital currencies.

Relative strength analysis is in the best state in markets with strong trends or themes, which can identify or indicate when it is the best time to invest in them. However, it may not be so useful in markets with no characteristics (volatile markets). Traditionally, investors can apply relative strength trading to stocks, mutual funds, ETFs, fixed income, commodity futures and other market sectors. In the digital currency market, more specifically, it can remind investors to pay attention to the best investment in individual categories, for example, whether they should choose small currencies among the currencies with strong performance. There is a great difference between relative strength and value investment. Although value investment seeks stocks that have underperformed in the past and hopes that they will perform well in the future, its relative strength has generated interest in those who have performed well and has played a role in its dynamic fluctuations.

### Implement the relative strength strategy on the FMZ Quant platform
- Strategy name: weak strategy based on relatively strong price

- Data period: 1H

- Support: commodity futures, digital currency, digital currency futures

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuopaowsens3eog2ohei.png)

- Main chart:
EMA, formula: MAN^^MA(C,N);

- Subchart:
Nil

```
MAN^^MA(C,N);
B_MA:=C>MAN;
S_MA:=C<MAN;

S_K1:=SUM((H-C)*V,N)/SUM((H-L)*V,N)>0.5;
B_K1:=SUM((C-L)*V,N)/SUM((H-L)*V,N)>0.5;

CO:=IF(C>O,C-O,0);
OC:=IF(C<O,O-C,0);
S_K2:=SUM(OC*V,N)/SUM(ABS(C-O)*V,N)>0.5;
B_K2:=SUM(CO*V,N)/SUM(ABS(C-O)*V,N)>0.5;

B_K1 AND B_K2 AND B_MA AND H>=HHV(H,N),BPK;
S_K1 AND S_K2 AND S_MA AND L<=LLV(L,N),SPK;

STOPLOSS:=M*MA(H-L,N);
C<BKPRICE-STOPLOSS,SP(BKVOL);
C>SKPRICE+STOPLOSS,BP(SKVOL);

S_MA AND BKHIGH>BKPRICE+STOPLOSS,SP(BKVOL);
B_MA AND SKLOW<SKPRICE-STOPLOSS,BP(SKVOL);
```
For the strategy source code, please refer to: https://www.fmz.com/strategy/129078.

From: https://blog.mathquant.com/2023/01/18/relative-strength-quantitative-trading-strategy-based-on-price.html