Dreadblitz

Engulfing Indicator

This is an "Engulfing" indicator. The "Engulfing" candle pattern is a reversal pattern that can appear at the end of an uptrend or downtrend.

The indicator includes the following inputs or settings:

1. `tolerance`: This defines the percentage difference in size that there must be between the body of the current candle and that of the previous candle to consider that one candle "engulfs" the other.
2. `tailSizePercentage`: This defines the maximum percentage size of the candle's tail in relation to the body of the candle for it to be considered valid.
3. `hideBuy` and `hideSell`: If set to true, they hide the buy and sell labels on the chart.
4. `checkTailSize` and `checkPrevTailSize`: If set to true, they check the size of the tail of the current and previous candle in relation to the body of the candle. If the tail is too large (as defined by `tailSizePercentage`), it is not considered valid.

The indicator works as follows:

First, it calculates the size of the body of the current and previous candle. Then, it checks if the current candle is green (close greater than open) or red (close less than open).

Next, it checks if the current candle "engulfs" the previous one. This means that, in the case of a green candle, the open must be less than or equal to the previous candle's close and the close must be greater than or equal to the previous candle's open. For a red candle, it's the other way around.

The indicator also checks if the size of the previous candle's body is at least a certain percentage (defined by `tolerance`) of the size of the current candle's body.

If `checkTailSize` or `checkPrevTailSize` is enabled, the indicator also checks the size of the tail of the current and/or previous candle. If the tail is too large in relation to the body of the candle (as defined by `tailSizePercentage`), the candle is not considered valid.

Finally, if all conditions are met, a buy or sell signal is generated and a label is drawn on the chart. An alert is also generated.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?