Create Account
Log In
Dark
chart
exchange
Premium
Terminal
Screener
Stocks
Crypto
Forex
Trends
Depth
Close
Check out our API

CYAN
CYANOTECH CORP
stock OTC

EOD
Jul 29, 2026
0.5298USD+0.019%(+0.0001)1,000
Pre-market
0.00USD-100.000%(-0.53)0
After-hours
0.00USD0.000%(0.00)0
OverviewPrice & VolumeSplitsHistoricalExchange VolumeDark Pool LevelsDark Pool PrintsExchangesShort VolumeShort Interest - DailyShort InterestBorrow Fee (CTB)Failure to Deliver (FTD)ShortsTrendsNewsTrends
CYAN Reddit Mentions
Subreddits
Limit Labels     

We have sentiment values and mention counts going back to 2017. The complete data set is available via the API.
Take me to the API
CYAN Specific Mentions
As of Aug 3, 2026 1:17:33 PM EDT (<1 min. ago)
Includes all comments and posts. Mentions per user per ticker capped at one per hour.
2 days ago • u/NomadStar45 • r/options • created_a_tos_script_for_auto_support_and • B
Gives you major and micro level support and resistance, for trading odte. Just ad it as a study in think script.
#ProjectionPivots_v04_MultiLevel_JQ
#Original Code and Concept by Mobius:
# V01.08.2012 Projection Pivots
# mobius
# Modified to add a second (minor/smaller timeframe) pivot tier
# Notes:
# 03.04.2019 added limits on extensions
# 03.05.2019 adjusted limits on extensions by adding user input upper and lower extension percent limits
# v04 added a second, shorter-lookback pivot tier (n2) so you get both major and minor S/R lines
#declare Once_Per_Bar;
#Inputs - MAJOR (original) pivots
input n = 21;
input showLines = yes;
input showValues = no;
input showBarNumbers = no;
input ExtensionLengthBars = 20; # controls length of Extension
input UpperExtensionPercentLimit = 5;
input LowerExtensionPercentLimit = 5;
input DisplayLabel = yes;
addlabel (DisplayLabel, "Projection Pivots n:" + n + " " , color.WHITE);
#Inputs - MINOR (new, smaller timeframe) pivots
input showMinorLevels = yes;
input n2 = 8; # shorter lookback = more frequent, smaller S/R swings
input showMinorLines = yes;
input showMinorValues = no;
input showMinorExtension = no; # minor extension lines off by default to reduce clutter
input DisplayMinorLabel = yes;
addlabel (DisplayMinorLabel and showMinorLevels, "Minor Pivots n2:" + n2 + " ", color.LIGHT_GRAY);
#Inputs - MICRO (new, even smaller timeframe) pivots
input showMicroLevels = yes;
input n3 = 4; # very short lookback = the tightest, most local swing points
input showMicroLines = yes;
input showMicroValues = no;
input showMicroExtension = no;
input DisplayMicroLabel = yes;
addlabel (DisplayMicroLabel and showMicroLevels, "Micro Pivots n3:" + n3 + " ", color.DARK_GRAY);
# Universal Header _v030429019 _JQ
# iData Definitions
def vHigh = high;
def vLow = low;
def vOpen = open;
def vClose = close;
def vVolume = volume;
def nan = Double.NaN;
# Bar Time & Date
def bn = BarNumber();
def currentBar = HighestAll(if !IsNaN(vHigh) then bn else nan);
# Bubble Locations
def x_AxisLastExpansionBar = BarNumber() == HighestAll(BarNumber());
# ============================================================
# MAJOR PIVOTS (original logic, length = n)
# ============================================================
def PH;
def PL;
def hh = fold i = 1 to n + 1
with p = 1
while p
do vHigh > getValue(vHigh, -i);
PH = if (bn > n and
vHigh == highest(vHigh, n) and
hh)
then vHigh
else double.NaN;
def ll = fold j = 1 to n + 1
with q = 1
while q
do vLow < getValue(low, -j);
PL = if (bn > n and
vLow == lowest(vLow, n) and
ll)
then vLow
else double.NaN;
def PHBar = if !isNaN(PH)
then bn
else PHBar[1];
def PLBar = if !isNaN(PL)
then bn
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 = bn >= highestAll(priorPHBar);
def LowPivots = bn >= highestAll(priorPLBar);
def FirstRpoint = if HighPivots
then bn - PHBar
else 0;
def PriorRpoint = if HighPivots
then bn - PriorPHBar
else 0;
def RSlope = (getvalue(PH, FirstRpoint) - getvalue(PH, PriorRpoint))
/ (PHBar - PriorPHBar);
def FirstSpoint = if LowPivots
then bn - PLBar
else 0;
def PriorSpoint = if LowPivots
then bn - PriorPLBar
else 0;
def SSlope = (getvalue(PL, FirstSpoint) - getvalue(PL, PriorSpoint))
/ (PLBar - PriorPLBar);
def RExtend = if bn == highestall(PHBar)
then 1
else RExtend[1];
def SExtend = if bn == 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.setDefaultColor(color.uptick);
pivotHighLine.setHiding(!showLines);
pivotHighLine.SetLineWeight(2);
plot RLine = pivotHigh;
RLine.enableApproximation();
RLine.SetDefaultColor(Color.LIGHT_GRAY);
RLine.SetStyle(Curve.Short_DASH);
def calc_ResistanceExtension = if RExtend
then (bn - PHBar) * RSlope + PHL
else double.NaN;
plot line_ResistanceExtension = if bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension else double.nan;
line_ResistanceExtension.SetStyle(Curve.Short_DASH);
line_ResistanceExtension.SetDefaultColor(color.LIGHT_GRAY);
line_ResistanceExtension.setLineWeight(1);
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.setDefaultColor(color.DOWNTICK);
pivotLowLine.setHiding(!showLines);
pivotLowLine.SetLineWeight(2);
plot SupportLine = pivotLow;
SupportLine.enableApproximation();
SupportLine.SetDefaultColor(color.LIGHT_GRAY);
SupportLine.SetStyle(Curve.Short_DASH);
def calc_SupportExtension = if SExtend
then (bn - PLBar) * SSlope + PLL
else double.NaN;
plot line_SupportExtension = if bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_supportExtension else double.nan;
line_SupportExtension.SetDefaultColor(color.LIGHT_GRAY);
line_SupportExtension.SetStyle(Curve.Short_DASH);
line_SupportExtension.setLineWeight(1);
plot BarNumbersBelow = bn;
BarNumbersBelow.SetDefaultColor(GetColor(0));
BarNumbersBelow.setHiding(!showBarNumbers);
BarNumbersBelow.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);
# ============================================================
# MINOR PIVOTS (new tier, shorter lookback = n2)
# Same math as above, just re-run against n2 with its own
# variable names (suffix "2") so it doesn't collide with the
# major tier. This is how you clone in a 3rd/4th tier if wanted.
# ============================================================
def PH2;
def PL2;
def hh2 = fold i2 = 1 to n2 + 1
with p2 = 1
while p2
do vHigh > getValue(vHigh, -i2);
PH2 = if (bn > n2 and
vHigh == highest(vHigh, n2) and
hh2)
then vHigh
else double.NaN;
def ll2 = fold j2 = 1 to n2 + 1
with q2 = 1
while q2
do vLow < getValue(low, -j2);
PL2 = if (bn > n2 and
vLow == lowest(vLow, n2) and
ll2)
then vLow
else double.NaN;
def PHBar2 = if !isNaN(PH2)
then bn
else PHBar2[1];
def PLBar2 = if !isNaN(PL2)
then bn
else PLBar2[1];
def PHL2 = if !isNaN(PH2)
then PH2
else PHL2[1];
def priorPHBar2 = if PHL2 != PHL2[1]
then PHBar2[1]
else priorPHBar2[1];
def PLL2 = if !isNaN(PL2)
then PL2
else PLL2[1];
def priorPLBar2 = if PLL2 != PLL2[1]
then PLBar2[1]
else priorPLBar2[1];
def HighPivots2 = bn >= highestAll(priorPHBar2);
def LowPivots2 = bn >= highestAll(priorPLBar2);
def FirstRpoint2 = if HighPivots2
then bn - PHBar2
else 0;
def PriorRpoint2 = if HighPivots2
then bn - PriorPHBar2
else 0;
def RSlope2 = (getvalue(PH2, FirstRpoint2) - getvalue(PH2, PriorRpoint2))
/ (PHBar2 - PriorPHBar2);
def FirstSpoint2 = if LowPivots2
then bn - PLBar2
else 0;
def PriorSpoint2 = if LowPivots2
then bn - PriorPLBar2
else 0;
def SSlope2 = (getvalue(PL2, FirstSpoint2) - getvalue(PL2, PriorSpoint2))
/ (PLBar2 - PriorPLBar2);
def RExtend2 = if bn == highestall(PHBar2)
then 1
else RExtend2[1];
def SExtend2 = if bn == highestall(PLBar2)
then 1
else SExtend2[1];
plot pivotHigh2 = if showMinorLevels and HighPivots2
then PH2
else double.NaN;
pivotHigh2.SetDefaultColor(Color.CYAN);
pivotHigh2.setPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
pivotHigh2.setHiding(!showMinorValues);
plot pivotHighLine2 = if showMinorLevels and PHL2 > 0 and
HighPivots2
then PHL2
else double.NaN;
pivotHighLine2.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotHighLine2.setDefaultColor(Color.CYAN);
pivotHighLine2.setHiding(!showMinorLines);
pivotHighLine2.SetLineWeight(1);
def calc_ResistanceExtension2 = if RExtend2
then (bn - PHBar2) * RSlope2 + PHL2
else double.NaN;
plot line_ResistanceExtension2 = if showMinorLevels and showMinorExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension2[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension2[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension2 else double.nan;
line_ResistanceExtension2.SetStyle(Curve.Short_DASH);
line_ResistanceExtension2.SetDefaultColor(Color.CYAN);
line_ResistanceExtension2.setLineWeight(1);
plot pivotLow2 = if showMinorLevels and LowPivots2
then PL2
else double.NaN;
pivotLow2.setDefaultColor(Color.MAGENTA);
pivotLow2.setPaintingStrategy(PaintingStrategy.VALUES_BELOW);
pivotLow2.setHiding(!showMinorValues);
plot pivotLowLine2 = if showMinorLevels and PLL2 > 0 and
LowPivots2
then PLL2
else double.NaN;
pivotLowLine2.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotLowLine2.setDefaultColor(Color.MAGENTA);
pivotLowLine2.setHiding(!showMinorLines);
pivotLowLine2.SetLineWeight(1);
def calc_SupportExtension2 = if SExtend2
then (bn - PLBar2) * SSlope2 + PLL2
else double.NaN;
plot line_SupportExtension2 = if showMinorLevels and showMinorExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension2[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension2[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_SupportExtension2 else double.nan;
line_SupportExtension2.SetDefaultColor(Color.MAGENTA);
line_SupportExtension2.SetStyle(Curve.Short_DASH);
line_SupportExtension2.setLineWeight(1);
# ============================================================
# MICRO PIVOTS (3rd tier, shortest lookback = n3)
# Same pattern again, suffix "3". Copy/rename this block again
# with suffix "4" etc. if you ever want a 4th tier.
# ============================================================
def PH3;
def PL3;
def hh3 = fold i3 = 1 to n3 + 1
with p3 = 1
while p3
do vHigh > getValue(vHigh, -i3);
PH3 = if (bn > n3 and
vHigh == highest(vHigh, n3) and
hh3)
then vHigh
else double.NaN;
def ll3 = fold j3 = 1 to n3 + 1
with q3 = 1
while q3
do vLow < getValue(low, -j3);
PL3 = if (bn > n3 and
vLow == lowest(vLow, n3) and
ll3)
then vLow
else double.NaN;
def PHBar3 = if !isNaN(PH3)
then bn
else PHBar3[1];
def PLBar3 = if !isNaN(PL3)
then bn
else PLBar3[1];
def PHL3 = if !isNaN(PH3)
then PH3
else PHL3[1];
def priorPHBar3 = if PHL3 != PHL3[1]
then PHBar3[1]
else priorPHBar3[1];
def PLL3 = if !isNaN(PL3)
then PL3
else PLL3[1];
def priorPLBar3 = if PLL3 != PLL3[1]
then PLBar3[1]
else priorPLBar3[1];
def HighPivots3 = bn >= highestAll(priorPHBar3);
def LowPivots3 = bn >= highestAll(priorPLBar3);
def FirstRpoint3 = if HighPivots3
then bn - PHBar3
else 0;
def PriorRpoint3 = if HighPivots3
then bn - PriorPHBar3
else 0;
def RSlope3 = (getvalue(PH3, FirstRpoint3) - getvalue(PH3, PriorRpoint3))
/ (PHBar3 - PriorPHBar3);
def FirstSpoint3 = if LowPivots3
then bn - PLBar3
else 0;
def PriorSpoint3 = if LowPivots3
then bn - PriorPLBar3
else 0;
def SSlope3 = (getvalue(PL3, FirstSpoint3) - getvalue(PL3, PriorSpoint3))
/ (PLBar3 - PriorPLBar3);
def RExtend3 = if bn == highestall(PHBar3)
then 1
else RExtend3[1];
def SExtend3 = if bn == highestall(PLBar3)
then 1
else SExtend3[1];
plot pivotHigh3 = if showMicroLevels and HighPivots3
then PH3
else double.NaN;
pivotHigh3.SetDefaultColor(Color.PLUM);
pivotHigh3.setPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
pivotHigh3.setHiding(!showMicroValues);
plot pivotHighLine3 = if showMicroLevels and PHL3 > 0 and
HighPivots3
then PHL3
else double.NaN;
pivotHighLine3.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotHighLine3.setDefaultColor(Color.PLUM);
pivotHighLine3.setHiding(!showMicroLines);
pivotHighLine3.SetLineWeight(1);
def calc_ResistanceExtension3 = if RExtend3
then (bn - PHBar3) * RSlope3 + PHL3
else double.NaN;
plot line_ResistanceExtension3 = if showMicroLevels and showMicroExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension3[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension3[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension3 else double.nan;
line_ResistanceExtension3.SetStyle(Curve.Short_DASH);
line_ResistanceExtension3.SetDefaultColor(Color.PLUM);
line_ResistanceExtension3.setLineWeight(1);
plot pivotLow3 = if showMicroLevels and LowPivots3
then PL3
else double.NaN;
pivotLow3.setDefaultColor(Color.WHITE);
pivotLow3.setPaintingStrategy(PaintingStrategy.VALUES_BELOW);
pivotLow3.setHiding(!showMicroValues);
plot pivotLowLine3 = if showMicroLevels and PLL3 > 0 and
LowPivots3
then PLL3
else double.NaN;
pivotLowLine3.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotLowLine3.setDefaultColor(Color.WHITE);
pivotLowLine3.setHiding(!showMicroLines);
pivotLowLine3.SetLineWeight(1);
def calc_SupportExtension3 = if SExtend3
then (bn - PLBar3) * SSlope3 + PLL3
else double.NaN;
plot line_SupportExtension3 = if showMicroLevels and showMicroExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension3[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension3[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_SupportExtension3 else double.nan;
line_SupportExtension3.SetDefaultColor(Color.WHITE);
line_SupportExtension3.SetStyle(Curve.Short_DASH);
line_SupportExtension3.setLineWeight(1);
# End Code
sentiment 1.00
2 days ago • u/NomadStar45 • r/options • created_a_tos_script_for_auto_support_and • B
Gives you major and micro level support and resistance, for trading odte. Just ad it as a study in think script.
#ProjectionPivots_v04_MultiLevel_JQ
#Original Code and Concept by Mobius:
# V01.08.2012 Projection Pivots
# mobius
# Modified to add a second (minor/smaller timeframe) pivot tier
# Notes:
# 03.04.2019 added limits on extensions
# 03.05.2019 adjusted limits on extensions by adding user input upper and lower extension percent limits
# v04 added a second, shorter-lookback pivot tier (n2) so you get both major and minor S/R lines
#declare Once_Per_Bar;
#Inputs - MAJOR (original) pivots
input n = 21;
input showLines = yes;
input showValues = no;
input showBarNumbers = no;
input ExtensionLengthBars = 20; # controls length of Extension
input UpperExtensionPercentLimit = 5;
input LowerExtensionPercentLimit = 5;
input DisplayLabel = yes;
addlabel (DisplayLabel, "Projection Pivots n:" + n + " " , color.WHITE);
#Inputs - MINOR (new, smaller timeframe) pivots
input showMinorLevels = yes;
input n2 = 8; # shorter lookback = more frequent, smaller S/R swings
input showMinorLines = yes;
input showMinorValues = no;
input showMinorExtension = no; # minor extension lines off by default to reduce clutter
input DisplayMinorLabel = yes;
addlabel (DisplayMinorLabel and showMinorLevels, "Minor Pivots n2:" + n2 + " ", color.LIGHT_GRAY);
#Inputs - MICRO (new, even smaller timeframe) pivots
input showMicroLevels = yes;
input n3 = 4; # very short lookback = the tightest, most local swing points
input showMicroLines = yes;
input showMicroValues = no;
input showMicroExtension = no;
input DisplayMicroLabel = yes;
addlabel (DisplayMicroLabel and showMicroLevels, "Micro Pivots n3:" + n3 + " ", color.DARK_GRAY);
# Universal Header _v030429019 _JQ
# iData Definitions
def vHigh = high;
def vLow = low;
def vOpen = open;
def vClose = close;
def vVolume = volume;
def nan = Double.NaN;
# Bar Time & Date
def bn = BarNumber();
def currentBar = HighestAll(if !IsNaN(vHigh) then bn else nan);
# Bubble Locations
def x_AxisLastExpansionBar = BarNumber() == HighestAll(BarNumber());
# ============================================================
# MAJOR PIVOTS (original logic, length = n)
# ============================================================
def PH;
def PL;
def hh = fold i = 1 to n + 1
with p = 1
while p
do vHigh > getValue(vHigh, -i);
PH = if (bn > n and
vHigh == highest(vHigh, n) and
hh)
then vHigh
else double.NaN;
def ll = fold j = 1 to n + 1
with q = 1
while q
do vLow < getValue(low, -j);
PL = if (bn > n and
vLow == lowest(vLow, n) and
ll)
then vLow
else double.NaN;
def PHBar = if !isNaN(PH)
then bn
else PHBar[1];
def PLBar = if !isNaN(PL)
then bn
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 = bn >= highestAll(priorPHBar);
def LowPivots = bn >= highestAll(priorPLBar);
def FirstRpoint = if HighPivots
then bn - PHBar
else 0;
def PriorRpoint = if HighPivots
then bn - PriorPHBar
else 0;
def RSlope = (getvalue(PH, FirstRpoint) - getvalue(PH, PriorRpoint))
/ (PHBar - PriorPHBar);
def FirstSpoint = if LowPivots
then bn - PLBar
else 0;
def PriorSpoint = if LowPivots
then bn - PriorPLBar
else 0;
def SSlope = (getvalue(PL, FirstSpoint) - getvalue(PL, PriorSpoint))
/ (PLBar - PriorPLBar);
def RExtend = if bn == highestall(PHBar)
then 1
else RExtend[1];
def SExtend = if bn == 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.setDefaultColor(color.uptick);
pivotHighLine.setHiding(!showLines);
pivotHighLine.SetLineWeight(2);
plot RLine = pivotHigh;
RLine.enableApproximation();
RLine.SetDefaultColor(Color.LIGHT_GRAY);
RLine.SetStyle(Curve.Short_DASH);
def calc_ResistanceExtension = if RExtend
then (bn - PHBar) * RSlope + PHL
else double.NaN;
plot line_ResistanceExtension = if bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension else double.nan;
line_ResistanceExtension.SetStyle(Curve.Short_DASH);
line_ResistanceExtension.SetDefaultColor(color.LIGHT_GRAY);
line_ResistanceExtension.setLineWeight(1);
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.setDefaultColor(color.DOWNTICK);
pivotLowLine.setHiding(!showLines);
pivotLowLine.SetLineWeight(2);
plot SupportLine = pivotLow;
SupportLine.enableApproximation();
SupportLine.SetDefaultColor(color.LIGHT_GRAY);
SupportLine.SetStyle(Curve.Short_DASH);
def calc_SupportExtension = if SExtend
then (bn - PLBar) * SSlope + PLL
else double.NaN;
plot line_SupportExtension = if bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_supportExtension else double.nan;
line_SupportExtension.SetDefaultColor(color.LIGHT_GRAY);
line_SupportExtension.SetStyle(Curve.Short_DASH);
line_SupportExtension.setLineWeight(1);
plot BarNumbersBelow = bn;
BarNumbersBelow.SetDefaultColor(GetColor(0));
BarNumbersBelow.setHiding(!showBarNumbers);
BarNumbersBelow.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);
# ============================================================
# MINOR PIVOTS (new tier, shorter lookback = n2)
# Same math as above, just re-run against n2 with its own
# variable names (suffix "2") so it doesn't collide with the
# major tier. This is how you clone in a 3rd/4th tier if wanted.
# ============================================================
def PH2;
def PL2;
def hh2 = fold i2 = 1 to n2 + 1
with p2 = 1
while p2
do vHigh > getValue(vHigh, -i2);
PH2 = if (bn > n2 and
vHigh == highest(vHigh, n2) and
hh2)
then vHigh
else double.NaN;
def ll2 = fold j2 = 1 to n2 + 1
with q2 = 1
while q2
do vLow < getValue(low, -j2);
PL2 = if (bn > n2 and
vLow == lowest(vLow, n2) and
ll2)
then vLow
else double.NaN;
def PHBar2 = if !isNaN(PH2)
then bn
else PHBar2[1];
def PLBar2 = if !isNaN(PL2)
then bn
else PLBar2[1];
def PHL2 = if !isNaN(PH2)
then PH2
else PHL2[1];
def priorPHBar2 = if PHL2 != PHL2[1]
then PHBar2[1]
else priorPHBar2[1];
def PLL2 = if !isNaN(PL2)
then PL2
else PLL2[1];
def priorPLBar2 = if PLL2 != PLL2[1]
then PLBar2[1]
else priorPLBar2[1];
def HighPivots2 = bn >= highestAll(priorPHBar2);
def LowPivots2 = bn >= highestAll(priorPLBar2);
def FirstRpoint2 = if HighPivots2
then bn - PHBar2
else 0;
def PriorRpoint2 = if HighPivots2
then bn - PriorPHBar2
else 0;
def RSlope2 = (getvalue(PH2, FirstRpoint2) - getvalue(PH2, PriorRpoint2))
/ (PHBar2 - PriorPHBar2);
def FirstSpoint2 = if LowPivots2
then bn - PLBar2
else 0;
def PriorSpoint2 = if LowPivots2
then bn - PriorPLBar2
else 0;
def SSlope2 = (getvalue(PL2, FirstSpoint2) - getvalue(PL2, PriorSpoint2))
/ (PLBar2 - PriorPLBar2);
def RExtend2 = if bn == highestall(PHBar2)
then 1
else RExtend2[1];
def SExtend2 = if bn == highestall(PLBar2)
then 1
else SExtend2[1];
plot pivotHigh2 = if showMinorLevels and HighPivots2
then PH2
else double.NaN;
pivotHigh2.SetDefaultColor(Color.CYAN);
pivotHigh2.setPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
pivotHigh2.setHiding(!showMinorValues);
plot pivotHighLine2 = if showMinorLevels and PHL2 > 0 and
HighPivots2
then PHL2
else double.NaN;
pivotHighLine2.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotHighLine2.setDefaultColor(Color.CYAN);
pivotHighLine2.setHiding(!showMinorLines);
pivotHighLine2.SetLineWeight(1);
def calc_ResistanceExtension2 = if RExtend2
then (bn - PHBar2) * RSlope2 + PHL2
else double.NaN;
plot line_ResistanceExtension2 = if showMinorLevels and showMinorExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension2[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension2[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension2 else double.nan;
line_ResistanceExtension2.SetStyle(Curve.Short_DASH);
line_ResistanceExtension2.SetDefaultColor(Color.CYAN);
line_ResistanceExtension2.setLineWeight(1);
plot pivotLow2 = if showMinorLevels and LowPivots2
then PL2
else double.NaN;
pivotLow2.setDefaultColor(Color.MAGENTA);
pivotLow2.setPaintingStrategy(PaintingStrategy.VALUES_BELOW);
pivotLow2.setHiding(!showMinorValues);
plot pivotLowLine2 = if showMinorLevels and PLL2 > 0 and
LowPivots2
then PLL2
else double.NaN;
pivotLowLine2.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotLowLine2.setDefaultColor(Color.MAGENTA);
pivotLowLine2.setHiding(!showMinorLines);
pivotLowLine2.SetLineWeight(1);
def calc_SupportExtension2 = if SExtend2
then (bn - PLBar2) * SSlope2 + PLL2
else double.NaN;
plot line_SupportExtension2 = if showMinorLevels and showMinorExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension2[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension2[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_SupportExtension2 else double.nan;
line_SupportExtension2.SetDefaultColor(Color.MAGENTA);
line_SupportExtension2.SetStyle(Curve.Short_DASH);
line_SupportExtension2.setLineWeight(1);
# ============================================================
# MICRO PIVOTS (3rd tier, shortest lookback = n3)
# Same pattern again, suffix "3". Copy/rename this block again
# with suffix "4" etc. if you ever want a 4th tier.
# ============================================================
def PH3;
def PL3;
def hh3 = fold i3 = 1 to n3 + 1
with p3 = 1
while p3
do vHigh > getValue(vHigh, -i3);
PH3 = if (bn > n3 and
vHigh == highest(vHigh, n3) and
hh3)
then vHigh
else double.NaN;
def ll3 = fold j3 = 1 to n3 + 1
with q3 = 1
while q3
do vLow < getValue(low, -j3);
PL3 = if (bn > n3 and
vLow == lowest(vLow, n3) and
ll3)
then vLow
else double.NaN;
def PHBar3 = if !isNaN(PH3)
then bn
else PHBar3[1];
def PLBar3 = if !isNaN(PL3)
then bn
else PLBar3[1];
def PHL3 = if !isNaN(PH3)
then PH3
else PHL3[1];
def priorPHBar3 = if PHL3 != PHL3[1]
then PHBar3[1]
else priorPHBar3[1];
def PLL3 = if !isNaN(PL3)
then PL3
else PLL3[1];
def priorPLBar3 = if PLL3 != PLL3[1]
then PLBar3[1]
else priorPLBar3[1];
def HighPivots3 = bn >= highestAll(priorPHBar3);
def LowPivots3 = bn >= highestAll(priorPLBar3);
def FirstRpoint3 = if HighPivots3
then bn - PHBar3
else 0;
def PriorRpoint3 = if HighPivots3
then bn - PriorPHBar3
else 0;
def RSlope3 = (getvalue(PH3, FirstRpoint3) - getvalue(PH3, PriorRpoint3))
/ (PHBar3 - PriorPHBar3);
def FirstSpoint3 = if LowPivots3
then bn - PLBar3
else 0;
def PriorSpoint3 = if LowPivots3
then bn - PriorPLBar3
else 0;
def SSlope3 = (getvalue(PL3, FirstSpoint3) - getvalue(PL3, PriorSpoint3))
/ (PLBar3 - PriorPLBar3);
def RExtend3 = if bn == highestall(PHBar3)
then 1
else RExtend3[1];
def SExtend3 = if bn == highestall(PLBar3)
then 1
else SExtend3[1];
plot pivotHigh3 = if showMicroLevels and HighPivots3
then PH3
else double.NaN;
pivotHigh3.SetDefaultColor(Color.PLUM);
pivotHigh3.setPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
pivotHigh3.setHiding(!showMicroValues);
plot pivotHighLine3 = if showMicroLevels and PHL3 > 0 and
HighPivots3
then PHL3
else double.NaN;
pivotHighLine3.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotHighLine3.setDefaultColor(Color.PLUM);
pivotHighLine3.setHiding(!showMicroLines);
pivotHighLine3.SetLineWeight(1);
def calc_ResistanceExtension3 = if RExtend3
then (bn - PHBar3) * RSlope3 + PHL3
else double.NaN;
plot line_ResistanceExtension3 = if showMicroLevels and showMicroExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_ResistanceExtension3[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_ResistanceExtension3[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_ResistanceExtension3 else double.nan;
line_ResistanceExtension3.SetStyle(Curve.Short_DASH);
line_ResistanceExtension3.SetDefaultColor(Color.PLUM);
line_ResistanceExtension3.setLineWeight(1);
plot pivotLow3 = if showMicroLevels and LowPivots3
then PL3
else double.NaN;
pivotLow3.setDefaultColor(Color.WHITE);
pivotLow3.setPaintingStrategy(PaintingStrategy.VALUES_BELOW);
pivotLow3.setHiding(!showMicroValues);
plot pivotLowLine3 = if showMicroLevels and PLL3 > 0 and
LowPivots3
then PLL3
else double.NaN;
pivotLowLine3.SetPaintingStrategy(PaintingStrategy.DASHES);
pivotLowLine3.setDefaultColor(Color.WHITE);
pivotLowLine3.setHiding(!showMicroLines);
pivotLowLine3.SetLineWeight(1);
def calc_SupportExtension3 = if SExtend3
then (bn - PLBar3) * SSlope3 + PLL3
else double.NaN;
plot line_SupportExtension3 = if showMicroLevels and showMicroExtension
and bn <= (Currentbar + ExtensionLengthBars)
and calc_SupportExtension3[1] >= (lowestall(vLow) * (1-(lowerExtensionPercentLimit/100)))
and calc_SupportExtension3[1] <= (Highestall(vHigh) * (1 + (upperExtensionPercentLimit/100)))
then calc_SupportExtension3 else double.nan;
line_SupportExtension3.SetDefaultColor(Color.WHITE);
line_SupportExtension3.SetStyle(Curve.Short_DASH);
line_SupportExtension3.setLineWeight(1);
# End Code
sentiment 1.00


Share
About
Pricing
Policies
Markets
API
Info
tz UTC-4
Connect with us
ChartExchange Email
ChartExchange on Discord
ChartExchange on X
ChartExchange on Reddit
ChartExchange on GitHub
ChartExchange on YouTube
© 2020 - 2026 ChartExchange LLC