Two different requests were made in the same topic in the Probuilder forum, one to be able to have the option of using either body or wicks for an engulfing candle, the other to add a filter of a number of consecutive candles in the same direction prior to the engulfing candle.
https://www.prorealcode.com/topic/codage-englobante/
Whilst it helps with some reversal patterns against a trend, it doesn’t filter out patterns going with a trend at the end of it. As such it is not ready-made for direct trading from it, but should just be considered as a piece of code to add to other filtering criteria of your own to trigger some detections only in the zones you’re interested in.
Use Ncandles as number of consecutive candles in same direction before engulfing
Use Body as boolean 0 or 1 to trigger « candle body mode » for engulfing detection
Use Wicks as boolean 0 or 1 to trigger « candle wicks mode » for engulfing detection
Result is histogram +/-0.5 for body mode, +/-1 for wicks mode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
// PRC Engulfing filtered with series of N previous consecutive candles in same direction // 24.11.2020 // Noobywan @ www.prorealcode.com // Sharing ProRealTime Knowledge // Forum ProBuilder request Charleddy, Axel98 // Parameters (Used as external parameters in download version) body=1 // = 0 or 1, Engulfing with body if =1 wicks=1 // = 0 or 1, Engulfing with wicks if =1 Ncandles=4 // Integer = Number of consecutive candles in same direction before engulfing //Initialisation resultat=0 englobante=0 if close>max(open[1],close[1]) and open<min(open[1],close[1]) and body then englobante=0.5 endif if close>high[1] and open<low[1] and wicks then englobante=1 endif if close<min(open[1],close[1]) and open>max(open[1],close[1]) and body then englobante=-0.5 endif if close<low[1] and open>high[1] and wicks then englobante=-1 endif serieB = (summation[Ncandles](close<close[1])=Ncandles) serieH = (summation[Ncandles](close>close[1])=Ncandles) if englobante>=0.5 and serieB[1] then resultat=englobante // returns 0.5 when body mode, 1 when wicks mode endif if englobante<=-0.5 and serieH[1] then resultat=englobante // returns -0.5 when body mode, -1 when wicks mode endif return resultat |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
This is very useful, look forward to testing it out. Thank you very much