Bretzay

MACD strategy + Trailstop indicator

Bretzay Uppdaterad   
Welcome traveler !

Here is my first indicator I made after 3 days of hardlearning pine code (beginner in coding).
I hope it will please you, if you have any suggestion to enhance this indicator, do not hesitate to give me your thoughts in the comments section or by Private message on trading View !

How does it works ?

It's a simple MACD strategy as describe here :
Uses of EMA 200 as a trend confirmer,
For sells :
When above Zero line (MACD) and under EMA200, we go on sell (background color is red)

For buys:
When under Zero line (MACD) and above EMA 200, we go on Buy (back ground color is green)

FILTERS !

I haded one filter to reduce noise on the indicator :
Signals aren't taken if one of the 14 last candles closed on the other side of the EMA 14.

What are the green and red lines ?
The green line is equivalent of a potential stop loss as a buyer side, same for the red one on seller side !
To make the space with the price bigger, please use "ATR multiplier" in the input options of the indicator while on your chart !

Is it timeframe specific ?

Hell no it is not timeframe specific ! You can try to use it on every timeframe !
As usual, I like to remind you that the best way to test an indicator is to go backtest it or to paper trade before using it on real market conditions !
If you find an idea of filter for a specific timeframe, do not hesitate to contact me ! I'll try to do my best to enhance this indicator as the time goes !

Is there repainting ?
There is no repainting on confirmation !
There's only a movement that I don't know how to ignore on the current open candle for the trail stop indicator I built, it should not be a problem if you place alerts to automatise your trading on the close of the candle, and not the high or low !
If you know how to resolve this problem with my code, I would be glad to get your tips to enhance the script ! :)

Example of the indicator in market (backtest, as said, no repaint on confirmation) :
Versionsinformation:
New user input to enable/disable :
- Background confirmations
- TrailStop filter : permit you to only see the SuperTrend Indicator or my selfmade add (make you see more places to place SL when supertrend isn't in the right direction)
- Added some informations to make inputs clearer (less plots without names)


The Stop loss is now filtered, to make the chart a bit cleaner
Some adjustments made to the ATR and the Trail stop to make it touched less by the price
Background between price and super trend so you can differenciate super trend indicator and the selfmade TS
Versionsinformation:
Just updating the visual on chart.
Versionsinformation:
.
Versionsinformation:
Repaired the error, script works well again !
Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?