5min MACD scalp by Joel

This strategy is inspired by a youtuber called Joel on Crypto. He trades this using Ema , MACD indicators and his own experience. For more information, check out his Best Crypto Scalping Strategy for the 5 Min Time Frame video. I have tried to automate this a little.

Long or Short trades are determined with a crossing of the fast Ema over the slow Ema for Long and the opposite for Short. Trades should only happen close to the crossovers. Then for Long we use the MACD indicator with a 1min TF (I had better results using the 5min) where we look for high peaks in negative values for Long and vice versa for Shorts. These should be significantly higher than other peaks (or if you will lower peaks for a Long).

Hence, the key is to detect high peaks on the histogram, which I try to achieve by checking if the last 2 values were higher than X bars back. If you want to make it even more specific, then you can turn on the additional checkbox which compares the current value to the average value of X bars back, and if it is greater than, say, 50% the value of the average (= 1.5x the average), then it's ok for the trade.

I also noticed that the strategy often bought at the top or bottom, so I added a check that compares whether the last evaluated bar is the first rising bar (for Long) or falling bar (for Short). This can be turned on or off.

Target profit 0,5% and stop loss 0,4% are based on his recommendation. The strategy is set to take only 1 trade at a time, and you can have a back tester table on.

I'm still a pine script beginner, so the strategy is certainly not perfect and could be improved. If you have any tips on how to improve it further, please let me know. I will try to update it when I have time.

I would also like to thank Joel on Crypto for sharing the strategy and @ZenAndTheArtOfTrading for his great library and code (thanks to him we have a back tester table in here), but especially his educational videos on youtube, which taught me a lot about pine script.

發布通知: I have made some significant changes and corrections, so I would recommend everyone to use the current version. I've also changed the defualt values for ones that give a better start.

New features and improvements:
- RSI filter, which sets the maximum RSI threshold for a long position and the minimum for a short,
- Ema trend picker, which gives more options for determining the trend. You can select individual Emas now,
- Back tester table will turn green if the strategy is profitable;

I hope that you'll find the strategy better to trade now. Feel free to test different values that go well outside the standard.

I will be glad if you let me know in the comments how you're doing and which values are the most profitable for you. I can also add inputs for 3commas robots if there is more interest.

Take care folks
發布通知: Added strategy Alerts for Long/Short open, further improvements (eg. minimal value of histogram bars)
發布通知: The update took me a little longer than I expected, but I tested it all the more. The update includes:
- Order fill alerts fix
- RSI filter extended with:
- Confirmation of the trade direction with RSI, i.e. for Long the RSI must rise a specified number of bars back, vice versa for Short
- Minimum RSI value for Long and maximum for Short
- Now EMAs can be plotted to the chart, but this is disabled by default (Style tab)
- 3commas connector – even with a free subscription you should be able to use it, as they start and stop the bots along with the orders

Tip: If you want the order fill alerts to show what type of order has just been triggered, then use placeholder {{}} in the alert message.

Warning: By taking the MACD histogram values from the lower TF (which is not the default setting anymore), it can get stuck although it may work you for several trades in a row. Unfortunately, I haven't found a way to prevent this, so use lower TF with caution and check it more often. Those who want to make sure it doesn't get stuck need to use the same or higher TFs. The same goes for the RSI values.

Instructions for the 3commas connector:
  • 1. First, you need to prepare 3commas Long/Short bots that will only listen to custom TV signals.
  • 2. Inputs for the 3commas bot can be found at the end of the user inputs.
  • 3. Once you have entered the required details into the inputs, turn on 3commas comments. They should appear on the chart (looks messy).
  • 4. Now you can add the alert where you should paste the 3commas Webhook URL: .
  • 5. For the alert message text insert the placeholder {{strategy.order.comment}} and delete the rest. 6. Once the alert is saved, you can turn off those 3commas comments to have a clearer chart.
  • 7. With a new alert, the bot and trade should launch.
發布通知: Minor update of the default values so that it shows trades on every security
發布通知: The script made trades sometimes too often, even when conditions weren't ideal, so I have added a pause for trades. (also applied on the screenshot with a pause for three bars)
發布通知: Cleanup of unused variables and RSI min-max values put inline

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。