Hello,

I am new to quantconnect, I would like to know if its possible to run a custom rsi indicator on the 233 minute or 4hr time frame on the spy

the code for the custom rsi

declare lower;

# Inputs:

input p = close;

input gamma = .236;

# Variables:

def L0;

def L1;

def L2;

def L3;

def CU;

def CD;

plot RSI;

plot OB;

plot OS;

plot ArrowUp;

plot ArrowDn;

# Script

script Laguerre{

input a = close;

input gamma = .5;

def L0 = ((1 - gamma) * a) + (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]);

plot Laguerre = (L0 + (2 * L1) + L2) / 4;

}

L0 = (1 – gamma) * p + gamma * L0[1];

L1 = - gamma * L0 + L0[1] + gamma * L1[1];

L2 = - gamma * L1 + L1[1] + gamma * L2[1];

L3 = - gamma * L2 + L2[1] + gamma * L3[1];

CU =

If L0 >= L1 then L0 - L1

Else If L1 >= L2 then CU[1] + L1 - L2

Else If L2 >= L3 then CU[1] + L2 - L3

Else 0;

CD =

If L0 <= L1 then L1 - L0

Else If L1 <= L2 then CD[1] + L2 - L1

Else If L2 <= L3 then CD[1] + L3 - L2

Else 0;

RSI =

Laguerre(a = if CU + CD <> 0 then CU / (CU + CD) else 0, gamma = 0);

OB =

if isNaN(RSI) then Double.NaN else .8;

OS =

if isNaN(RSI) then Double.NaN else .2;

RSI.SetDefaultColor(Color.Cyan);

OB.SetDefaultColor(Color.Yellow);

OS.SetDefaultColor(Color.Yellow);

AddCloud(OB,1,Color.Light_Red);

AddCloud(OS,0,Color.Light_Green);

ArrowUp = if RSI crosses above OS then OS else Double.Nan;

ArrowUp.SetPaintingStrategy(PaintingStrategy.Arrow_UP);

ArrowUP.SetLineWeight(3);

ArrowUp.SetDefaultColor(Color.Green);

ArrowDn = if RSI crosses below OB then OB else Double.NaN;

ArrowDn.SetPaintingStrategy(PaintingStrategy.Arrow_Down);

ArrowDn.SetLineWeight(3);

ArrowDn.SetDefaultColor(Color.Red);

Alert(!isNaN(ArrowUp), "", Alert.Bar, Sound.Ring);

Alert(!isNaN(ArrowDn), "", Alert.Bar, Sound.Ring);

Thanks

Best Regards

Roger

Author