Mobius Projection Pivots For ThinkOrSwim
This was a poster request. Mobius Project Pivots is the same script as found in the top post (and as shown in image2) with less plots.
The code for the 1st image is directly below. The code for the JQ version is in the top post.
Shared Chart link: http://tos.mx/BFx7MRL Click here for --> Easiest way to load shared links
This was a poster request. Mobius Project Pivots is the same script as found in the top post (and as shown in image2) with less plots.
read more here: https://www.investopedia.com/trading/using-pivot-points-for-predictions/Pivot points are used by traders in equity and commodity exchanges. They're calculated based on the high, low, and closing prices of previous trading sessions, and they're used to predict support and resistance levels in the current or upcoming session. These support and resistance levels can be used by traders to determine entry and exit points, both for stop-losses and profit taking. ~Investopedia
The code for the 1st image is directly below. The code for the JQ version is in the top post.
Shared Chart link: http://tos.mx/BFx7MRL Click here for --> Easiest way to load shared links
Ruby:
# V01.08.2012 Projection Pivots
# mobius
# 10.06.2016 Altered the fold expression relacing the index variable with -1
input n = 13;
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(l, -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 Projection Pivots
Hi Ben/Team, Where can I find the original Mobius algorithm for this? I want to develop a python script for this. Thank you!
Last edited: