conflixx95493

MACD Crossover trend strategy, Long and Short

conflixx95493 Cập nhật   
Hey everybody,

This is my first strategy and script I wrote mostly myself. There's tons of content out there to learn how to code in Pinescript and it's exactly what I wanted and needed in this time of my life.

In any case, I made a rather simple MACD crossover strategy that only takes trades in the direction of both EMA and SMA (there are inputs to change the length of the moving averages and lots of other stuff too).
If the MACD line crosses upwards on the signal line, while above the zero point of the histogram and the price is above EMA + SMA , it's a long signal.
If the MACD line cosses downards on the signal line, while below zero on the histogram and the price is below EMA + SMA , it's a short signal.

There are a lot of default variables that make no sense, for basically any symbol you're going to be looking at. You're going to have to adjust the EMA , SMA , backtest date, take profit, stop loss and all that good stuff yourself to find decently profitable parameters.

I made this myself because I couldn't really find a strategy out there that allowed for so much customizing and it's an easy way to get started in Pinescript.

If you have any suggestions, tips or you see a flatout mistake in my code, please let me know. I'm still learning, everyday and I'm enjoying every second of it.
Phát hành các Ghi chú:
Initially I wanted to rewrite my MACD script and release a new one. Eventually it ended up looking too much alike and I've decided to just overwrite my previous MACD strategy.
My previous MACD script only had one option, it had a static stop loss and take profit. This is bad, I knew this from the beginning but I had to start somewhere. Now that I know how I can go around fixing that, I've decided to just overwrite my previous MACD script.

This script gives you two options, the entry signal is always the same, it's been the same in my previous script and it's the same now. The exit signals are vastly different though. Previously it was a static stop loss and take profit, now I changed it to either pullback decided by the 20 period high or low(basically Donchian Channels, which is why I say they're mixed). The other option is where we let the MACD indicator do all the work, if we're in a position(either long or short) when the MACD inversely corsses the signal line that means we exit our position.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?