ApeX Predator
Well-known member
@PlayTrader Here is what you asked for. I took the liberty to add R1 line too along with S1.
Setup your scanner as custom script and your scan query will look like the below.
For finding the support AKA S1 of Wolf_Wave indicator posted in Original Comment here.
Setup your scanner as custom script and your scan query will look like the below.
For finding the support AKA S1 of Wolf_Wave indicator posted in Original Comment here.
Code:
Wolf_Waves_Scan().Bull within 25 bars
Code:
Wolf_Waves_Scan().Bear within 25 bars
Code:
# Modified by @SuryaKiranC, An Attempt to create S1 & R1 for Scan #Requested by @PlayTrader
# Wolf_Waves_Scan
# Mobius
# V01.05.22.2018
input n = 10;
script LinePlot {
input BarID = 0;
input Value = 0;
input BarOrigin = 0;
def ThisBar = HighestAll(BarOrigin);
def ValueLine = if BarOrigin == ThisBar then Value else Double.NaN;
plot P = if ThisBar - BarID <= BarOrigin then HighestAll(ValueLine) else Double.NaN;
}
# Variables
def o = open;
def h = high;
def l = low;
def c = close;
def x = BarNumber();
def xN = x == HighestAll(x);
# R1
def hh = fold i = 1 to n + 1with p = 1 while p do h > GetValue(h, -i);
def PivotH = if (x > n and h == Highest(h, n) and hh) then h else Double.NaN;
def PHValue = if !IsNaN(PivotH) then PivotH else PHValue[1];
def PHBarOrigin = if !IsNaN(PivotH) then x else PHBarOrigin[1];
def PHBarID = x - PHBarOrigin;
# S1
def ll = fold j = 1 to n + 1 with q = 1 while q do l < GetValue(l, -j);
def PivotL = if (x > n and l == Lowest(l, n) and ll) then l else Double.NaN;
def PLValue = if !IsNaN(PivotL) then PivotL else PLValue[1];
def PLBarOrigin = if !IsNaN(PivotL) then x else PLBarOrigin[1];
def PLBarID = x - PLBarOrigin;
plot Bear = if (x == HighestAll(PHBarOrigin) and PHValue) then 1 else 0;
Bear.Hide();
plot Bull = if (x == HighestAll(PLBarOrigin) and PLValue) then 1 else 0;
Bull.Hide();
plot scan = (Bear or Bull);
Last edited: