The Matrix Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Converted from the Matrix Series indicator on TradingView. Brought to you by @diazlaz

Some context about this indicator (found on wisestocktrader):
You can find the exactly same formula in here. Its name is Matrix Series. I’ve been using it for while, and I think this is a good indicator. Eventhough it is prepared for accumulation/distribution recognizing phase, but based on my observations, it shows when the trend begin getting stronger.

There’re 3 ways to use it. I usually get entry position when :
1. Candle upward before / after cross the zero line
2. Candle downward but real candle is sideways. This will be best when price is in oversold area.
3. Candle downward and begin to change from big to small. It is usually followed by significant movement.

When down candle with the red real candle is occur, it almost certainly bearish signal.

FYI, I use it in daily chart.

hbax9rA.png


thinkScript Code

Code:
#Matrix Series for ThinkorSwim V1.0
#
#CREDITS
# glaz
# https://www.tradingview.com/script/2X2cVLhb-Matrix-Series/
#
#CHANGELOG
# 2019.12.06 1.0 @diazlaz - Initial Port
#
#LINKS
# https://www.wisestocktrader.com/indicators/2739-flower-indicator
# https://www.wisestocktrader.com/indicators/1087-matrix-series
#
#
#DESCRIPTION
#Please use the following AFL on your exisitng AMIBROKER Chart & get a edge in
#identifying Accumulation/Distribution zone of any market.
#Each levels can act like support & resistance
#( watch for +/- 200 levels & the dots when appear on the chart )
#Title of the Flower Chart will go RED if we are entering in a Distribution
#phase & Green for Accumulation.
#This is a modified RENKO chart & should be used with MPLITE & any Momentum
#indicator combination for best results.
#
#There’re 3 ways to use it. I usually get entry position when :
#1. Candle upward before / after cross the zero line
#2. Candle downward but real candle is sideways. This will be best when price is in oversold area.
#3. Candle downward and begin to change from big to small. It is usually followed by significant movement.
#When down candle with the red real candle is occur, it almost certainly bearish signal.
#FYI, I use it in daily chart.

declare lower;

#INPUTS
input Smoother = 5;
input SupResPeriod = 50;
input SupResPercentage = 100;
input PricePeriod = 16;
input ob = 200;
input os = -200;
input showColorBars = no; #COLOR BARS
input showDynamics = no; #Dynamic zones
input showOBOS = yes; #Show OB/OS

#LOGIC
def nn = Smoother;
def ys1 = (high + low + close * 2) / 4;
def rk3 = ExpAverage(ys1, nn);
def rk4 = StDev(ys1, nn);
def rk5 = (ys1 - rk3) * 200 / rk4;
def rk6 = ExpAverage(rk5, nn);
def up = ExpAverage(rk6, nn);
def down = ExpAverage(up, nn);
def Oo = If(up < down, up, down);
def Hh = Oo;
def Ll = If(up < down, down, up);
def Cc = Ll;


def Lookback = SupResPeriod;
def PerCent = SupResPercentage;
def Pds = PricePeriod;

def C3 = CCI(length = Pds);

def Osc = C3;
def Value1 = Osc;
def Value2 = Highest(Value1, Lookback);
def Value3 = Lowest(Value1, Lookback);
def Value4 = Value2 - Value3;
def Value5 = Value4 * (PerCent / 100);
def ResistanceLine = Value3 + Value5;
def SupportLine = Value2 - Value5;

#CUSTOM CANDLES
def cUpO;
def cUpH;
def cUpL;
def cUpC;
if up > down
then {
    cUpO = oo;
    cUpH = hh;
    cUpL = ll;
    cUpC = cc;
} else {
    cUpO = Double.NaN;
    cUpH = Double.NaN;
    cUpL = Double.NaN;
    cUpC = Double.NaN;
}

def cDnO;
def cDnH;
def cDnL;
def cDnC;
if up < down
then {
    cDnO = Oo;
    cDnH = Hh;
    cDnL = Ll;
    cDnC = Cc;
} else {
    cdnO = Double.NaN;
    cdnH = Double.NaN;
    cdnL = Double.NaN;
    cdnC = Double.NaN;
}

AddChart(high = cUpH, low = cUpL, open = cUpC, close = cUpO, type = ChartType.CANDLE, COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnO, close = cDnC, type = ChartType.CANDLE, COLOR.RED);
AddChart(high = cUpH, low = cUpL, open = cUpO, close = cUpC, type = ChartType.CANDLE, growcolor = COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnC, close = cDnO, type = ChartType.CANDLE, growcolor = COLOR.RED);

#COLORBARS
AssignPriceColor(if showColorBars then
 if Oo > Cc then COLOR.RED else if up > down then COLOR.GREEN
 else COLOR.RED
else
  COLOR.CURRENT
);

#PLOTS
plot pResistanceLine = ResistanceLine;
pResistanceLine.SetHiding(!showDynamics);

plot pSupportLine = SupportLine;
pSupportLine.SetHiding(!showDynamics);

def UpShape = if up > ob and up > down then highest(up,1) + 20 else if up > ob and up < down then highest(down,1) + 20 else Double.NaN;

def DownShape = if down < os and up > down then lowest(down,1) - 20 else if
 down < os and up < down then lowest(up,1) - 20 else Double.NaN;

def sState = if !isNan(UpShape) then 100 else if !isNan(DownShape) then -100 else sState[1];

plot pUP = UpShape;
pUP.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pUP.SetDefaultColor(Color.CYAN);
pUP.SetLineWeight(1);

plot pDown = DownShape;
pDown.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pDown.SetDefaultColor(Color.CYAN);
pDown.SetLineWeight(1);
;

plot pOB = OB;
pOB.SetHiding(!showOBOS);

plot pOS = OS;
pOS.SetHiding(!showOBOS);
 

horserider

Well-known member
VIP
Some type of smoothed CCI. Guess it shows CCI 200 levels but main trading of CCI is cross of 100 levels if my memory is correct.
 

BigScalp

Member
VIP
Converted from the Matrix Series indicator on TradingView. Brought to you by @diazlaz

Some context about this indicator (found on wisestocktrader):


hbax9rA.png


thinkScript Code

Code:
#Matrix Series for ThinkorSwim V1.0
#
#CREDITS
# glaz
# https://www.tradingview.com/script/2X2cVLhb-Matrix-Series/
#
#CHANGELOG
# 2019.12.06 1.0 @diazlaz - Initial Port
#
#LINKS
# https://www.wisestocktrader.com/indicators/2739-flower-indicator
# https://www.wisestocktrader.com/indicators/1087-matrix-series
#
#
#DESCRIPTION
#Please use the following AFL on your exisitng AMIBROKER Chart & get a edge in
#identifying Accumulation/Distribution zone of any market.
#Each levels can act like support & resistance
#( watch for +/- 200 levels & the dots when appear on the chart )
#Title of the Flower Chart will go RED if we are entering in a Distribution
#phase & Green for Accumulation.
#This is a modified RENKO chart & should be used with MPLITE & any Momentum
#indicator combination for best results.
#
#There’re 3 ways to use it. I usually get entry position when :
#1. Candle upward before / after cross the zero line
#2. Candle downward but real candle is sideways. This will be best when price is in oversold area.
#3. Candle downward and begin to change from big to small. It is usually followed by significant movement.
#When down candle with the red real candle is occur, it almost certainly bearish signal.
#FYI, I use it in daily chart.

declare lower;

#INPUTS
input Smoother = 5;
input SupResPeriod = 50;
input SupResPercentage = 100;
input PricePeriod = 16;
input ob = 200;
input os = -200;
input showColorBars = no; #COLOR BARS
input showDynamics = no; #Dynamic zones
input showOBOS = yes; #Show OB/OS

#LOGIC
def nn = Smoother;
def ys1 = (high + low + close * 2) / 4;
def rk3 = ExpAverage(ys1, nn);
def rk4 = StDev(ys1, nn);
def rk5 = (ys1 - rk3) * 200 / rk4;
def rk6 = ExpAverage(rk5, nn);
def up = ExpAverage(rk6, nn);
def down = ExpAverage(up, nn);
def Oo = If(up < down, up, down);
def Hh = Oo;
def Ll = If(up < down, down, up);
def Cc = Ll;


def Lookback = SupResPeriod;
def PerCent = SupResPercentage;
def Pds = PricePeriod;

def C3 = CCI(length = Pds);

def Osc = C3;
def Value1 = Osc;
def Value2 = Highest(Value1, Lookback);
def Value3 = Lowest(Value1, Lookback);
def Value4 = Value2 - Value3;
def Value5 = Value4 * (PerCent / 100);
def ResistanceLine = Value3 + Value5;
def SupportLine = Value2 - Value5;

#CUSTOM CANDLES
def cUpO;
def cUpH;
def cUpL;
def cUpC;
if up > down
then {
    cUpO = oo;
    cUpH = hh;
    cUpL = ll;
    cUpC = cc;
} else {
    cUpO = Double.NaN;
    cUpH = Double.NaN;
    cUpL = Double.NaN;
    cUpC = Double.NaN;
}

def cDnO;
def cDnH;
def cDnL;
def cDnC;
if up < down
then {
    cDnO = Oo;
    cDnH = Hh;
    cDnL = Ll;
    cDnC = Cc;
} else {
    cdnO = Double.NaN;
    cdnH = Double.NaN;
    cdnL = Double.NaN;
    cdnC = Double.NaN;
}

AddChart(high = cUpH, low = cUpL, open = cUpC, close = cUpO, type = ChartType.CANDLE, COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnO, close = cDnC, type = ChartType.CANDLE, COLOR.RED);
AddChart(high = cUpH, low = cUpL, open = cUpO, close = cUpC, type = ChartType.CANDLE, growcolor = COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnC, close = cDnO, type = ChartType.CANDLE, growcolor = COLOR.RED);

#COLORBARS
AssignPriceColor(if showColorBars then
 if Oo > Cc then COLOR.RED else if up > down then COLOR.GREEN
 else COLOR.RED
else
  COLOR.CURRENT
);

#PLOTS
plot pResistanceLine = ResistanceLine;
pResistanceLine.SetHiding(!showDynamics);

plot pSupportLine = SupportLine;
pSupportLine.SetHiding(!showDynamics);

def UpShape = if up > ob and up > down then highest(up,1) + 20 else if up > ob and up < down then highest(down,1) + 20 else Double.NaN;

def DownShape = if down < os and up > down then lowest(down,1) - 20 else if
 down < os and up < down then lowest(up,1) - 20 else Double.NaN;

def sState = if !isNan(UpShape) then 100 else if !isNan(DownShape) then -100 else sState[1];

plot pUP = UpShape;
pUP.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pUP.SetDefaultColor(Color.CYAN);
pUP.SetLineWeight(1);

plot pDown = DownShape;
pDown.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pDown.SetDefaultColor(Color.CYAN);
pDown.SetLineWeight(1);
;

plot pOB = OB;
pOB.SetHiding(!showOBOS);

plot pOS = OS;
pOS.SetHiding(!show
[/QUOTE]
Works great on 5M charts. Doesn't show anything on several 1M charts. Anyway to fix that?
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
Works great on 5M charts. Doesn't show anything on several 1M charts. Anyway to fix that?
This script uses AddChart which is an unsupported function in ToS. There isn't a workaround to get it to work when it chooses not to.
 

lnb1217

New member
Converted from the Matrix Series indicator on TradingView. Brought to you by @diazlaz

Some context about this indicator (found on wisestocktrader):


hbax9rA.png


thinkScript Code

Code:
#Matrix Series for ThinkorSwim V1.0
#
#CREDITS
# glaz
# https://www.tradingview.com/script/2X2cVLhb-Matrix-Series/
#
#CHANGELOG
# 2019.12.06 1.0 @diazlaz - Initial Port
#
#LINKS
# https://www.wisestocktrader.com/indicators/2739-flower-indicator
# https://www.wisestocktrader.com/indicators/1087-matrix-series
#
#
#DESCRIPTION
#Please use the following AFL on your exisitng AMIBROKER Chart & get a edge in
#identifying Accumulation/Distribution zone of any market.
#Each levels can act like support & resistance
#( watch for +/- 200 levels & the dots when appear on the chart )
#Title of the Flower Chart will go RED if we are entering in a Distribution
#phase & Green for Accumulation.
#This is a modified RENKO chart & should be used with MPLITE & any Momentum
#indicator combination for best results.
#
#There’re 3 ways to use it. I usually get entry position when :
#1. Candle upward before / after cross the zero line
#2. Candle downward but real candle is sideways. This will be best when price is in oversold area.
#3. Candle downward and begin to change from big to small. It is usually followed by significant movement.
#When down candle with the red real candle is occur, it almost certainly bearish signal.
#FYI, I use it in daily chart.

declare lower;

#INPUTS
input Smoother = 5;
input SupResPeriod = 50;
input SupResPercentage = 100;
input PricePeriod = 16;
input ob = 200;
input os = -200;
input showColorBars = no; #COLOR BARS
input showDynamics = no; #Dynamic zones
input showOBOS = yes; #Show OB/OS

#LOGIC
def nn = Smoother;
def ys1 = (high + low + close * 2) / 4;
def rk3 = ExpAverage(ys1, nn);
def rk4 = StDev(ys1, nn);
def rk5 = (ys1 - rk3) * 200 / rk4;
def rk6 = ExpAverage(rk5, nn);
def up = ExpAverage(rk6, nn);
def down = ExpAverage(up, nn);
def Oo = If(up < down, up, down);
def Hh = Oo;
def Ll = If(up < down, down, up);
def Cc = Ll;


def Lookback = SupResPeriod;
def PerCent = SupResPercentage;
def Pds = PricePeriod;

def C3 = CCI(length = Pds);

def Osc = C3;
def Value1 = Osc;
def Value2 = Highest(Value1, Lookback);
def Value3 = Lowest(Value1, Lookback);
def Value4 = Value2 - Value3;
def Value5 = Value4 * (PerCent / 100);
def ResistanceLine = Value3 + Value5;
def SupportLine = Value2 - Value5;

#CUSTOM CANDLES
def cUpO;
def cUpH;
def cUpL;
def cUpC;
if up > down
then {
    cUpO = oo;
    cUpH = hh;
    cUpL = ll;
    cUpC = cc;
} else {
    cUpO = Double.NaN;
    cUpH = Double.NaN;
    cUpL = Double.NaN;
    cUpC = Double.NaN;
}

def cDnO;
def cDnH;
def cDnL;
def cDnC;
if up < down
then {
    cDnO = Oo;
    cDnH = Hh;
    cDnL = Ll;
    cDnC = Cc;
} else {
    cdnO = Double.NaN;
    cdnH = Double.NaN;
    cdnL = Double.NaN;
    cdnC = Double.NaN;
}

AddChart(high = cUpH, low = cUpL, open = cUpC, close = cUpO, type = ChartType.CANDLE, COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnO, close = cDnC, type = ChartType.CANDLE, COLOR.RED);
AddChart(high = cUpH, low = cUpL, open = cUpO, close = cUpC, type = ChartType.CANDLE, growcolor = COLOR.GREEN);
AddChart(high = cDnH, low = cDnL, open = cDnC, close = cDnO, type = ChartType.CANDLE, growcolor = COLOR.RED);

#COLORBARS
AssignPriceColor(if showColorBars then
 if Oo > Cc then COLOR.RED else if up > down then COLOR.GREEN
 else COLOR.RED
else
  COLOR.CURRENT
);

#PLOTS
plot pResistanceLine = ResistanceLine;
pResistanceLine.SetHiding(!showDynamics);

plot pSupportLine = SupportLine;
pSupportLine.SetHiding(!showDynamics);

def UpShape = if up > ob and up > down then highest(up,1) + 20 else if up > ob and up < down then highest(down,1) + 20 else Double.NaN;

def DownShape = if down < os and up > down then lowest(down,1) - 20 else if
 down < os and up < down then lowest(up,1) - 20 else Double.NaN;

def sState = if !isNan(UpShape) then 100 else if !isNan(DownShape) then -100 else sState[1];

plot pUP = UpShape;
pUP.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pUP.SetDefaultColor(Color.CYAN);
pUP.SetLineWeight(1);

plot pDown = DownShape;
pDown.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
pDown.SetDefaultColor(Color.CYAN);
pDown.SetLineWeight(1);
;

plot pOB = OB;
pOB.SetHiding(!showOBOS);

plot pOS = OS;
pOS.SetHiding(!showOBOS);
Can someone add a label indicating the accumulation zone & distribution zone? I can't tell which part of the code it is & the commented out description says the title of a flower chart changes but idk what that is.
 

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top