Coinrule

EMA and MACD with Trailing Stop Loss (by Coinrule)

An exponential moving average ( EMA ) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. The exponential moving average is also referred to as the exponentially weighted moving average. An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average simple moving average ( SMA ), which applies an equal weight to all observations in the period.

Moving average convergence divergence ( MACD ) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period exponential moving average ( EMA ) from the 12-period EMA.

The result of that calculation is the MACD line. A nine-day EMA of the MACD called the "signal line," is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals. Traders may buy the security when the MACD crosses above its signal line and sell—or short—the security when the MACD crosses below the signal line. Moving average convergence divergence ( MACD ) indicators can be interpreted in several ways, but the more common methods are crossovers, divergences, and rapid rises/falls.

The Strategy enters and closes the trade when the following conditions are met:

LONG
The MACD histogram turns bearish
EMA7 is greater than EMA14

EXIT
Price increases 3% trailing
Price decreases 1% trailing

This strategy is back-tested from 1 January 2022 to simulate how the strategy would work in a bear market and provides good returns.

Pairs that produce very strong results include XRPUSDT on the 1-minute timeframe. This short timeframe means that this strategy opens and closes trades regularly

In order to further improve the strategy, the EMA can be changed from 7 and 14 to, say, EMA20 and EMA50. Furthermore, the trailing stop loss can also be changed to ideally suit the user to match their needs.

The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?