dugafish
New member
I am trying to create a scan (using a Mobius custom indicator called FilterL) that selects for when RSI (any length but I use 9) is greater than FilterL however the scan function doesnt seem to be able to calculate FilterL even though as an indicator it works perfectly in my charts. Any suggestions for how I can the scan function to recognize this custom variable?
#RSI with Laguerre Filter applied at 6 period length
# Mobius
# V02.2012
# Modulation self adjusting with RSI volatility range
declare lower;
input RSIrr = .01;
input length = 6;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input ZERO_LINE = 50;
def o = open;
def h = high;
def l = low;
def c = close;
def NetChgAvg = WildersAverage(price - price[1], length);
def TotChgAvg = WildersAverage(AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 50 * (ChgRatio + 1);
RSI.SetDefaultColor(Color.Yellow);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot ZEROLINE=ZERO_LINE;
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
def RSIh = highest(RSI, length);
def RSIl = lowest(RSI, length);
def RSIr = RSIrr * Average(RSIh - RSIl, length);
def gamma = if RSIr > .9
then .9
else if RSIr < .2
then .2
else gamma[1];
def bar = barNumber();
def L0 = ((1 - gamma) * RSI) + (gamma * L0[1]);
def L1 = (-gamma * L0) + L0[1] + (gamma * L1[1]);
def L2 = (-gamma * L1) + L1[1] + (gamma * L2[1]);
def L3 = (-gamma * L2) + L2[1] + (gamma * L3[1]);
def L4 = (-gamma * L3) + L3[1] + (gamma * L4[1]);
def L5 = (-gamma * L4) + L4[1] + (gamma * L5[1]);
def Laguerre = (L0 + (2 * L1) + (2 * L2) + L3 + L4 + L5) / 8;
plot FilterL = Laguerre;
FilterL.SetDefaultColor(Color.Cyan);
def condUp = if RSI crosses above FilterL
then 1
else if RSI > RSI[1]
then condUp[1] + 1
else if RSI < FilterL
then 0
else condUp[1];
def condDw = if RSI crosses below FilterL
then 1
else if RSI < RSI[1]
then condDw[1] + 1
else if RSI > FilterL
then 0
else condDw[1];
def CrossUp = RSI crosses above FilterL && FilterL > 50;
def Crossdown = RSI crosses below FilterL && FilterL < 50;
plot condDW1 =CrossUp;
plot condUP1 = Crossdown;
plot confirmUP = filterL crosses above 50;
plot confirmDOWN = filterL crosses below 50;
addCloud(rsi, filterl, Color.GREEN, Color.RED);
# End Code RSI with Laguerre Filter
#RSI with Laguerre Filter applied at 6 period length
# Mobius
# V02.2012
# Modulation self adjusting with RSI volatility range
declare lower;
input RSIrr = .01;
input length = 6;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input ZERO_LINE = 50;
def o = open;
def h = high;
def l = low;
def c = close;
def NetChgAvg = WildersAverage(price - price[1], length);
def TotChgAvg = WildersAverage(AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 50 * (ChgRatio + 1);
RSI.SetDefaultColor(Color.Yellow);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot ZEROLINE=ZERO_LINE;
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
def RSIh = highest(RSI, length);
def RSIl = lowest(RSI, length);
def RSIr = RSIrr * Average(RSIh - RSIl, length);
def gamma = if RSIr > .9
then .9
else if RSIr < .2
then .2
else gamma[1];
def bar = barNumber();
def L0 = ((1 - gamma) * RSI) + (gamma * L0[1]);
def L1 = (-gamma * L0) + L0[1] + (gamma * L1[1]);
def L2 = (-gamma * L1) + L1[1] + (gamma * L2[1]);
def L3 = (-gamma * L2) + L2[1] + (gamma * L3[1]);
def L4 = (-gamma * L3) + L3[1] + (gamma * L4[1]);
def L5 = (-gamma * L4) + L4[1] + (gamma * L5[1]);
def Laguerre = (L0 + (2 * L1) + (2 * L2) + L3 + L4 + L5) / 8;
plot FilterL = Laguerre;
FilterL.SetDefaultColor(Color.Cyan);
def condUp = if RSI crosses above FilterL
then 1
else if RSI > RSI[1]
then condUp[1] + 1
else if RSI < FilterL
then 0
else condUp[1];
def condDw = if RSI crosses below FilterL
then 1
else if RSI < RSI[1]
then condDw[1] + 1
else if RSI > FilterL
then 0
else condDw[1];
def CrossUp = RSI crosses above FilterL && FilterL > 50;
def Crossdown = RSI crosses below FilterL && FilterL < 50;
plot condDW1 =CrossUp;
plot condUP1 = Crossdown;
plot confirmUP = filterL crosses above 50;
plot confirmDOWN = filterL crosses below 50;
addCloud(rsi, filterl, Color.GREEN, Color.RED);
# End Code RSI with Laguerre Filter