Easy to Use MACD+RSI Strategy


Easy to use strategy test using MACD with RSI as a confirming indicator. The code is structured to make it easy to manipulate the variables to your choosing.

LINE 2 = Change the amount you invest every trade and the currency
LINE 8/9/10 = Change the defval of each of these lines to backtest from a certain date
LINE 16/17/18 = Change the MACD sensitivity by changing the defval on each line
LINE 21 = Change the value after close toadjust the sensitivity of the RSI
LINE 37/39 = Change/remove the < and > variables for macdLine and rsivalue after the crossover/crossunder to adjust your buying point further.

As a beginner you may not feel comfortable with shorting stocks, therefore LINE 5 was added to only allows long positions.

Funny how a simple indicator can return such a high profitability. Couple this with some trend/exit strategies and you'll have something really special!

Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích

Bình luận

Is this a script to set an alert or something else?
+2 Phản hồi
@mac_dick, it's most useful as a back-testing strategy, a way to see how profitable a security is based on the MACD/RSI variables you put in place. It does show you when to buy/sell, but it won't actually send you an alert.
Phản hồi
Hi! How could we adjust the RSI levels (eg instead of 30/70, make it 20/80)? Thanks =)
Phản hồi
TrendsAreSexy MadMoto29
@MadMoto29, Within LINE 37 and 39 you can adjust your buying parameters by changing the value after rsivalue. You'll see in the code above that the buy order uses an RSI value of less than 50. You can adjust this and add this portion to your sell order code to tweak your numbers further.
Phản hồi
Hi thanks for sharing this. Would you be willing to fork a version suitable for binary options testing, or share a line or two of code for what to add? I'm sure the only thing missing is the ability to set the expiry time (eg in candles). Thanks for considering!
Phản hồi
Thanks for posting this! For anyone playing around, I was having significantly less luck than the above performance, so adjusted to also sell if rsivalue > 70. Profits jumped significantly in backdating testing. Just food for though.
Phản hồi
kjbint swmacint
@swmacint, Hey, mind sharing your updated script with me? I have been trying to rewrite the above using pine version 4 vs the 2 it was written in but havent had much luck.
Phản hồi
what is the purpose of the Hline code on line 30?
Phản hồi
TrendsAreSexy Hodl4dearlife
@Hodl4dearlife, it plots the dashed horizontal line you see in the MACD section. Entirely cosmetic.
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất