wouterpruym1828

Combining Trailing Stop and Stop loss (% of instrument price)

wouterpruym1828 Actualizado   
Both a trailing stop and a stop loss are necessary tools for every trader, for locking in as much profit in any given trade, while on the other hand minimizing the risks involved in trading.
I started to write this scipt to give an answer to many traders who wanted these two tools combined, but didn't find any way to program this.
TV has some shortcomings in the built-in functions regarding this topic. You can use 'stop' and 'limit', or 'loss' and 'profit' and even functions with trailing stops. But all of these lack the flexibility of the use of percentages.
I used many ideas of the community, and with this scrip I want to give back to the community.

The strategy is just a simple crossing of two Exponential Moving Averages, so do not start trading based solely on this script.
Also keep in mind that no two assets are the same, and adjustments should be made in the configuration for every asset.
This script should be viewed as a template, just take out the chunks of code you need. A savvy programmer can undoubtedly implement a 'take profit' of 50% halfway down the trade.

The features are:
-Everything is easily adjustable through the configuration section
-2 EMA's which form the strategy to go Long or Short
-Trailing stop, which adjust itself every bar according to the configuration
-Stop loss, which uses the entry price of the trade and stays at the same level according to the configuration
-The chart provides a visual reference for the levels of both stops

Happy trading!
Notas de prensa:
-Added take profit option, at a chosen price in % for a chosen % of equity
-After take profit took place, the stop loss updates to a chosen price level in % in advance of the entry price, thereby securing profit.
Notas de prensa:
Adjusted how the script calculates the stop loss after taking profit
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?