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)
Can this code be tweeked in such a way that the entry is valid only it breaks the low or high of the engulfing candle, and SL Low or High of the Engulfing candle.
example, if the high breaks (Engulfing Candle), then Long, and SL is Low of engulfing Candle, and vice-versa for Sell position?
That will be of immense value and help to get the strategy tested.