# RSI in Laguerre Time Self Adjusting With Fractal Energy # Mobius # V03.06.15.2016 # Both Fractal Energy and RSI are plotted. RSI in cyan and FE in yellow. Look for trend exhaustion in the FE and a reversal of RSI or Price compression in FE and an RSI reversal. declare lower; #Inputs: input nFE = 13;#hint nFE: length for Fractal Energy calculation. # Variables: def o; def h; def l; def c; def CU1; def CU2; def CU; def CD1; def CD2; def CD; def L0; def L1; def L2; def L3; plot RSI; plot OS; plot OB; # Calculations o = (open + close[1]) / 2; h = Max(high, close[1]); l = Min(low, close[1]); c = (o + h + l + close) / 4; plot gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE) / (Highest(high, nFE) - Lowest(low, nFE))) / Log(nFE); gamma.SetDefaultColor(Color.Yellow); L0 = (1 – gamma) * c + 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]; if L0 >= L1 then { CU1 = L0 - L1; CD1 = 0; } else { CD1 = L1 - L0; CU1 = 0; } if L1 >= L2 then { CU2 = CU1 + L1 - L2; CD2 = CD1; } else { CD2 = CD1 + L2 - L1; CU2 = CU1; } if L2 >= L3 then { CU = CU2 + L2 - L3; CD = CD2; } else { CU = CU2; CD = CD2 + L3 - L2; } RSI = if CU + CD <> 0 then CU / (CU + CD) else 0; RSI.SetDefaultColor(Color.Cyan); OS = if IsNaN(close) then Double.NaN else 0.2; OS.SetDefaultColor(Color.Gray); OS.HideBubble(); OS.HideTitle(); OB = if IsNaN(close) then Double.NaN else 0.8; OB.SetDefaultColor(Color.Gray); OB.HideBubble(); OB.HideTitle(); plot FEh = if isNaN(close) then double.nan else .618; FEh.SetStyle(Curve.Long_Dash); FEh.HideBubble(); FEh.SetDefaultColor(Color.Dark_Gray); FEh.HideTitle(); plot FEl = if isNaN(close) then double.nan else .382; FEl.SetStyle(Curve.Long_Dash); FEl.SetDefaultColor(Color.Dark_Gray); FEl.HideBubble(); FEl.HideTitle(); AddCloud(0, OS, Color.Green, Color.Green); AddCloud(OB, 1, Color.Red, Color.Red); Alert(RSI crosses below .9, "", Alert.BAR, Sound.Bell); Alert(RSI crosses above .1, "", Alert.BAR, Sound.Bell); # End Code RSI_Laguerre Self Adjusting with Fractal Energy Code for Projection Pivots # V01.08.2012 Projection Pivots # mobius declare Once_Per_Bar; input n = 21; input showLines = no; input showValues = no; input showBarNumbers = no; def h = high; def l = low; def bar = barNumber(); def PH; def PL; def hh = fold i = 1 to n + 1 with p = 1 while p do h > getValue(h, -i); PH = if (bar > n and h == highest(h, n) and hh) then h else double.NaN; def ll = fold j = 1 to n + 1 with q = 1 while q do l < getValue(low, -j); PL = if (bar > n and l == lowest(l, n) and ll) then l else double.NaN; def PHBar = if !isNaN(PH) then bar else PHBar[1]; def PLBar = if !isNaN(PL) then bar else PLBar[1]; def PHL = if !isNaN(PH) then PH else PHL[1]; def priorPHBar = if PHL != PHL[1] then PHBar[1] else priorPHBar[1]; def PLL = if !isNaN(PL) then PL else PLL[1]; def priorPLBar = if PLL != PLL[1] then PLBar[1] else priorPLBar[1]; def HighPivots = bar >= highestAll(priorPHBar); def LowPivots = bar >= highestAll(priorPLBar); def FirstRpoint = if HighPivots then bar - PHBar else 0; def PriorRpoint = if HighPivots then bar - PriorPHBar else 0; def RSlope = (getvalue(PH, FirstRpoint) - getvalue(PH, PriorRpoint)) / (PHBar - PriorPHBar); def FirstSpoint = if LowPivots then bar - PLBar else 0; def PriorSpoint = if LowPivots then bar - PriorPLBar else 0; def SSlope = (getvalue(PL, FirstSpoint) - getvalue(PL, PriorSpoint)) / (PLBar - PriorPLBar); def RExtend = if bar == highestall(PHBar) then 1 else RExtend[1]; def SExtend = if bar == highestall(PLBar) then 1 else SExtend[1]; plot pivotHigh = if HighPivots then PH else double.NaN; pivotHigh.SetDefaultColor(GetColor(1)); pivotHigh.setPaintingStrategy(PaintingStrategy.VALUES_ABOVE); pivotHigh.setHiding(!showValues); plot pivotHighLine = if PHL > 0 and HighPivots then PHL else double.NaN; pivotHighLine.SetPaintingStrategy(PaintingStrategy.DASHES); pivotHighLine.setHiding(!showLines); plot RLine = pivotHigh; RLine.enableApproximation(); RLine.SetDefaultColor(GetColor(7)); RLine.SetStyle(Curve.Short_DASH); plot RExtension = if RExtend then (bar - PHBar) * RSlope + PHL else double.NaN; RExtension.SetStyle(Curve.Short_DASH); RExtension.SetDefaultColor(GetColor(7)); plot pivotLow = if LowPivots then PL else double.NaN; pivotLow.setDefaultColor(GetColor(4)); pivotLow.setPaintingStrategy(PaintingStrategy.VALUES_BELOW); pivotLow.setHiding(!showValues); plot pivotLowLine = if PLL > 0 and LowPivots then PLL else double.NaN; pivotLowLine.SetPaintingStrategy(PaintingStrategy.DASHES); pivotLowLine.setHiding(!showLines); plot SupportLine = pivotLow; SupportLine.enableApproximation(); SupportLine.SetDefaultColor(GetColor(7)); SUpportLine.SetStyle(Curve.Short_DASH); plot SupportExtension = if SExtend then (bar - PLBar) * SSlope + PLL else double.NaN; SupportExtension.SetDefaultColor(GetColor(7)); SupportExtension.SetStyle(Curve.Short_DASH); plot BN = bar; BN.SetDefaultColor(GetColor(0)); BN.setHiding(!showBarNumbers); BN.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); plot PivotDot = if !isNaN(pivotHigh) then pivotHigh else if !isNaN(pivotLow) then pivotLow else double.NaN; pivotDot.SetDefaultColor(GetColor(7)); pivotDot.SetPaintingStrategy(PaintingStrategy.POINTS); pivotDot.SetLineWeight(3); # End Code TheoTrade Projection Pivots