conflixx95493

MACD Crossover trend strategy, Long and Short

conflixx95493 Güncellendi   
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.
Sürüm Notları:
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.
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?