TradingView
Drun30
Mar 21, 2021 1:06 PM

Momentum Strategy (BTC/USDT; 1h) - MACD (with source code) 

Bitcoin / TetherUSBinance

Description

Good morning traders.
It's been a while from my last publication of a strategy and today I want to share with you this small piece of script that showed quite interesting result across bitcoin and other altcoins.

The macd indicator is an indicator built on the difference between a fast moving average and a slow moving average: this difference is generally plottted with a blue line while the orange line is simply a moving average computed on this difference.

Usually this indicator is used in technical analysis for getting signals of buy and sell respectively when the macd crosses above or under its moving average: it means that the distance of the fast moving average (the most responsive one) from the slower one is getting lower than what it-used-to-be in the period considered: this could anticipate a cross of the two moving averages and you want to anticipate this potential trend reversal by opening a long position

Of course the workflow is specularly the same for opening short positions (or closing long positions)

What this strategy does is simply considering the moving average computed on macd and applying a linear regression on it: in this way, even though the signal can be sligthly delayed, you reduce noise plotting a smooth curve.

Then, it simply checks the maximums and the minimums of this curve detecting whenever the changes of the values start to be negative or positive, so it opens a short position (closes long) on the maximum on this curve and it opens a long position (closes short) on the minimum.

Of course, I set an option for using this strategy in a conventional way working on the crosses between macd and its moving average. Alternatively you can use this workflow if you prefer.

In conclusion, you can use a tons of moving averages: I made a function in pine in order to allw you to use any moving average you want for the two moving averages on which the macd is based or for the moving average computed on the macd

PLEASE, BE AWARE THAT THIS TRADING STRATEGY DOES NOT GUARANTEE ANY KIND OF SUCCESS IN ADVANCE. YOU ARE THE ONE AND ONLY RESPONSIBLE OF YOUR OWN DECISIONS, I DON'T TAKE ANY RESPONSIBILITY ASSOCIATED WITH THEM. IF YOU RUN THIS STRATEGY YOU ACCEPT THE POSSIBILITY OF LOOSING MONEY, ALL OF MY PUBBLICATIONS ARE SUPPOSED TO BE JUST FOR EDUCATIONAL PURPOSES.
IT IS AT YOUR OWN RISK WHETHER TO USE IT OR NOT

But if you make money out of this, please consider to buy me a beer 😜

Happy Trading!

Release Notes

Added compounding for backtest

Release Notes

Added filter/take profit RSI in order to increase the percentage of profitable trades
Comments
aleks1811
Hello, this strategy still work?
rt1994
rt1994
Hello my friend! I've tried a lot of indicators, but yours is my favorite! I connected it to a bot that trades automatically according to signals from the indicator. I have allocated 1000 $ for the test and I plan to trade each signal of your indicator during the year with x2 leverage.

However, I am worried about the 35% drawdown that formed on the BTCUSDT chart right now. This is the biggest drawdown of the strategy in the last 2 years, and it worries me a little.

I am concerned that the nature of the market may have changed and the strategy may have lost its relevance. Unfortunately, my knowledge does not allow me to assess the level of threat. Perhaps you could comment on this situation, I would be very grateful to you!
rogert771
this is one of the best strategy i seen i wish it had alerts
polpol07
bro, this algo is amazing. Can i have the aleart version of this? i try to transform it to alert version alr but it didn't work, im not good at coding.
Ericlu82
there is no alert for entry and close?
Drun30
@Ericlu82, it is a strategy
Bright5050
what's the meaning of the red and purple arrow ?
Drun30
@Bright5050, opening short positions (red), closing positions (purple)
Bright5050
@Drun30, Oh okay thanks so much
More