Depending on whether the market is above or below the 200 , the script determines if the market is in or territory. Above the 200 , the script will ignore the 20 as a buy condition and buy solely on the confirmation of a cross upon the close of a candle. In this market, the script will only enable the sell condition if both the is AND a close below the 20 occurs. This is to reduce the chances of the script selling prematurely in the event of a cross, if the market is still in overall territory.
When the market is below the 200 , the confirmation occurs in the opposite direction. The buy condition will only be met if both the is AND a close above the 20 occurs. However, the sell condition ignores the 20 and will sell solely on the confirmation of a cross upon the close of the candle.
This strategy can be used in both and markets. This conservative strategy will slightly underperform in a bull market, with the sell condition occasionally being met and then potentially buying back higher. However, it will successfully get you out of a turning market and automatically switch into a more 'risk-off' mentality during a bear market. This strategy is not recommended for sideways markets, as trading around the 20 coupled with a relatively flat profile can cause the strategy to buy the peaks and sell troughs easily.
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.