In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
//@version=2 strategy("Super Envolvente", overlay=true) secLast = 1 checkingHighsAndLows(position) => high >= high[position] and low <= low[position] isBearishEngulfing(position) => checkingHighsAndLows(position) and open >= close[position] and open >= open[position] and close <= open[position] and close <= close[position] isBullishEngulfing(position) => checkingHighsAndLows(position) and open <= close[position] and open <= open[position] and close >= open[position] and close >= close[position] longCondition = isBullishEngulfing(1) if (longCondition) strategy.entry("Long Entry", strategy.long) shortCondition = isBearishEngulfing(1) if (shortCondition) strategy.entry("Short Entry", strategy.short)