Code to search back a pattern of WOLF WAVES.
This screeners searches back in a configurable period the patten of WOLF WAVES.
The accuracy of the wolf wave can be configurable at the beginning of the code.
The screener generates a list with the values that are matching with the parameters.
It is returned as “Point_1” the value of the first point of Wolf wave, so you need to go to chart and search for this value, in the screenshot was returned the value of 148,51.
Parameters manages by code:
-That point 1 and 3 are not differing more than a percentage value.
-That point 2 and 4 are not differing more than a percentage value.
-That the distance between point 1-3 and point 2-4 are not different more than a number of candles, to avoid a far point 4, for example.
-That ramps 1-2 and 3-4 are not differing more than a percentage, to assure that ramps are within a range of angle.
//-----------------------------Configure screener
TIMEFRAME(daily)
//--------analysis for value conditions--------
//
// Maximum % allowed between peaks 1-3 and also for valley 2-4
// Example: point 3 must not differ from point 1 more than this value
maxVgap=2
//---- Distance in candles between candles 1-3
// and 3-4 must not differ in a number
// greater than maxcandle
// to assure equitative ramps
MaxCandle=4
//-- Analysis for timing conditions en percentage
// in %, maximum diference between ramps
// Distance between points 1-2 and 3-4 must not exceed this value
// to assusre equitative ramps
MaxTiempoGap=30
//-- Maximum candles searched back
Lookback=100
//------------------------------ Code
zz = ZigZag[4](close)
p = zz<zz[1] and zz[1]>zz[2]
v = zz>zz[1] and zz[1]<zz[2]
if p then
top = zz[1]
endif
if v then
bottom = zz[1]
endif
//------ Point 1 detection
for i =lookback downto 1 do
if v[i] then
Vpunto1= bottom[i]
punto1=1
vela1=i
break
ENDIf
next
//--------Point 2 detection
if punto1=1 then//-- Only in first point of waves is already detected
for i =vela1-1 downto 1 do //--start to search from previous point
if p[i] then
Vpunto2= top[i]
punto2=1
vela2=i
break
ENDIf
next
endif
//------Point 3 detection
if punto2=1 then
for i =vela2-1 downto 1 do//--start to search from previous point
if v[i] then
Vpunto3= bottom[i]
punto3=1
vela3=i
break
ENDIf
next
endif
//-----------Point 4 detection
if punto3=1 then
for i =vela3-1 downto 1 do//--start to search from previous point
if p[i] then
Vpunto4= top[i]
punto4=1
vela4=i
break
ENDIf
next
endif
//--------Point 5 detection
if punto4=1 then
for i =vela4-1 downto 1 do//--start to search from previous point
if v[i] then
Vpunto5= bottom[i]
punto5=1
vela5=i
break
ENDIf
next
endif
//---------------------------------Analysis
//-- Value Point 3 compared with point 1 must not exceed the configured delta
Gap13=abs((Vpunto3*100)/Vpunto1)-100
Gap13OK=Gap13 <maxVGap
//-- Value Point 4 compared with point 2 must not exceed the configured delta
Gap24=abs((Vpunto4*100)/Vpunto2)-100
Gap24OK=abs(Gap24) <maxVGap
//--Distance between candles of point 1-2 and 3-4 must not differ more than the percentage set at begin,assuring equitative ramps
Tiempo12=abs(Vela2-Vela1)
Tiempo34=abs(Vela4-Vela3)
TiemposGap=abs(((tiempo34*100)/Tiempo12)-100)
CT=TiemposGap<MaxTiempoGap
//--Distance between points 1-3 and 2-4, must be lower than 3 candles
//--may be used also percentage
Tiempo13=abs(Vela3-Vela1)
Tiempo24=abs(Vela2-Vela4)
CD=abs(Tiempo13-Tiempo24)<MaxCandle
C1= (punto1=1) and (Vpunto1<>0)
C2= (punto2=1) and (Vpunto2<>0)
C3= (punto3=1) and (Vpunto3<>0) and (Vpunto3 > Vpunto1) and Gap13OK //--ramps are equitative
C4= vela4<>0 and (punto4=1) and (Vpunto4<>0) and (Vpunto4 < Vpunto2) and Gap24OK
C5= vela5<>0 and (punto5=1) and (Vpunto5<>0) and (Vpunto5 < Vpunto3) //-- Point 5 lowe than point 3
screener[C1 and C2 and C3 and C4 and C5 and CT and CD ](Vpunto1 as "Point_1")//- First point of WOLF WAVE, search for thi valley