Engulfing body or wicks mode and filter on previous candles

Category: Indicators By: JC_Bywan Created: December 23, 2020, 11:22 AM
December 23, 2020, 11:22 AM
Indicators
1 Comment

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

// 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

Download
Filename: PRC_req_englobantefiltre.itf
Downloads: 142
JC_Bywan Master
https://market.prorealcode.com/store/volume-profile-solutions/ - Trading since 2008, using PRT since 2009, PRC forums moderator since 2016, helping out when I can. Using personal algorithmic universal market model (any market, any timeframe, self-adaptating no optimisation required), and volume profile and tape personal tools. Scientific coding skills from past life in aerospace sector, in Computational Fluid Dynamics.
Author’s Profile

Comments

Logo Logo
Loading...