Super 6x: RSI, MACD, Stoch, Loxxer, CCI, & Velocity [Loxx] for ThinkOrSwim

Thanks Samer! (y) (y)

Been manually backtesting and paper trading it the last couple days, and I really like using the magenta/cyan trigger candles as breakout candles. To that effect, I went ahead and turned this into a stand alone upper study and added a few helpful tweaks from bits of code I found from halcyonguy and elsewhere here on the boards. Figured I'd post it here if anybody else wants it-

Lu0OqBC.jpg


Added:
-Cyan and Magenta lines at candle high/low act as trigger lines
-White trigger arrows when candle closes below/above the line.
-Pink lines at the high/lows of candles act as stops
-High/Low prices marked on the trigger candle

-I added a pink dash on cyan/magenta candles that acts as a reference so that you can quickly see where your maximum loss is. In this case, for instance, on the chart above, my maximum loss per trade is $20 per contract or approximately .40 cents of the underlying assuming a .50 delta. When the dash line appears between the two candle lines, you can quickly see where you may want to adjust your stop if you so choose.

-I added a white dash to the crossover candle, to quickly see where my max loss has shifted in relation to how far over the line the candle has crossed.

Both dashes can be turned on/off in settings or adjusted for your max loss. If you want to run the upper and lower together, make sure to turn off the 'paint candles' option in one of the studies, and make sure your repaint selections match. From what MerryDay posted, as the code is complex, you may only want to run one of them. I've noticed no problem so far running only the upper. PS I'm no code expert, I only scavenge and repurpose from what I can make sense of, so if anybody thinks the code needs cleaned up feel free.

Code:
#/ This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#https://www.tradingview.com/v/U30edqhu/
#// © loxx
#indicator("Super 6x: RSI, MACD, Stoch, Loxxer, CCI, & Velocity [Loxx]", shorttitle="S6XRMSDCV [Loxx]",
# Converted by Sam4Cok@Samer800 - 03/2023
# Upper signals /DarthTradicus,halcyonguy
#declare lower;

input ColorTriggerCandle = yes;
input colorbars = yes;  # "Color bars?"
input loxxPeriod = 14;     # 'Loxxer Period'
input loxxChartTimeframe = yes;
input loxxAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Loxxer Resolution'
input loxxRepainting = yes;    # 'Loxxer Allow Repainting?'

input macdSource = close;   # 'MACD Source'
input macdFastPeriod = 12;  # 'MACD Fast Period'
input macdSlowPeriod = 26;  # 'MACD Slow Period'
input macdChartTimeframe = yes;
input macdAgg = AggregationPeriod.FIFTEEN_MIN;    # 'MACD Resolution'
input macdRepainting = yes;  # 'MACD Allow Repainting?'

input rsiSource = close;     # 'RSI Source'
input rsiPeriod = 14;        # 'RSI Period'
input rsiChartTimeframe = yes;
input rsiAgg = AggregationPeriod.FIFTEEN_MIN;    # 'RSI Resolution'
input rsiRepainting = yes;   # 'RSI Allow Repainting?'

input VelocitySource = close;     # 'Velocity Source'
input VelocityPeriod = 32;        # "Velocity Period"
input VelocityFastPeriod = 1;     # "Velocity Fast Period"
input VelocitySlowPeriod = 2;     # "Velocity Slow Period"
input VelChartTimeframe = yes;
input velAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Velocity Resolution'
input velRepainting = yes;         # 'Velocity Allow Repainting?'

input cciSource = close;     # "CCI Source"
input cciPeriod = 14;          # "CCI Period"
input cciChartTimeframe = yes;
input cciAgg = AggregationPeriod.FIFTEEN_MIN;    # 'CCI Resolution'
input cciRepainting = yes;         # 'CCI Allow Repainting?'

input periodK = 14;         # "Stochasitc %K Length"
input smoothK = 1;          # "Stochasitc %K Smoothing"
input periodD = 3;          # "Stochasitc %D Smoothing"
input stochChartTimeframe = yes;
input stochAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Stochasitc Resolution'
input stochRepainting = yes;       # 'Stochasitc Allow Repainting?'

def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
def last = isNaN(close);
def isrealtime = !IsNaN(close);
########### Theme 1################
DefineGlobalColor("green" , Color.GREEN);
DefineGlobalColor("red"   , Color.RED);
# stoch(source, high, low, length) =>
script stoch {
    input src = close;
    input h = high;
    input l = low;
    input len = 14;
    def stoch = 100 * (src - Lowest(l, len)) / (Highest(h, len) - Lowest(l, len));
    plot return = stoch;
}
#_imom(src, length, powSlow, powFast)=>
script _imom {
    input src = close;
    input length = 32;
    input powSlow = 1;
    input powFast = 2;
    def suma;
    def sumwa;
    def imom;
    def sumb;
    def sumwb;
    suma = fold k = 0 to length with p do
           p  + src[k]  * Power(length - k, powSlow);
    sumb = fold k1 = 0 to length with p1 do
           p1 + src[k1] * Power(length - k1, powFast);
    sumwa = fold k2 = 0 to length with p2 do
           p2 + Power(length - k2, powSlow);
    sumwb = fold k3 = 0 to length with p3 do
           p3 + Power(length - k3, powFast);
    imom = (sumb / sumwb - suma / sumwa);
    plot out = imom;
}
#_dm(per, res, rep)=>
script _dm {
    input per = 14;
    input changeHi = 0;
    input changeLo = 0;
    def demax = if changeHi>0 then changeHi else 0;
    def demin = if changeLo<0 then AbsValue(changeLo) else 0;
    def maxma = Average(demax, per);
    def minma = Average(demin, per);
    def loxxer = 100 * maxma / (maxma + minma);
    plot out = loxxer;
}
def macdsrc = if macdChartTimeframe then
    if macdRepainting then macdSource else if isrealtime then macdSource[1] else macdSource else
    if macdRepainting then close(Period = macdAgg) else if isrealtime then close(Period = macdAgg)[1] else close(Period = macdAgg);
def rsisrc = if rsiChartTimeframe then
    if rsiRepainting then rsiSource else if isrealtime then rsiSource[1] else rsiSource else
    if rsiRepainting then close(Period = rsiAgg) else if isrealtime then close(Period = rsiAgg)[1] else close(Period = rsiAgg);
def velsrc = if VelChartTimeframe then
    if velRepainting then VelocitySource else if isrealtime then VelocitySource[1] else VelocitySource else
    if velRepainting then close(Period = velAgg) else if isrealtime then close(Period = velAgg)[1] else close(Period = velAgg);
def ccisrc = if cciChartTimeframe then
    if cciRepainting then cciSource else if isrealtime then cciSource[1] else cciSource else
    if cciRepainting then close(Period = cciAgg) else if isrealtime then close(Period = cciAgg)[1] else close(Period = cciAgg);
def stochhi = if stochChartTimeframe then
    if stochRepainting then high else if isrealtime then high[1] else high else
    if stochRepainting then high(Period = stochAgg) else if isrealtime then high(Period = stochAgg)[1] else high(Period = stochAgg);
def stochlo = if stochChartTimeframe then
    if stochRepainting then low else if isrealtime then low[1] else low else
    if stochRepainting then low(Period = stochAgg) else if isrealtime then low(Period = stochAgg)[1] else low(Period = stochAgg);
def stochclose = if stochChartTimeframe then
    if stochRepainting then close else if isrealtime then close[1] else close else
    if stochRepainting then close(Period = stochAgg) else if isrealtime then close(Period = stochAgg)[1] else close(Period = stochAgg);
def highin = if loxxChartTimeframe then
    if loxxRepainting then high else if isrealtime then high[1] else high else
    if loxxRepainting then high(Period = loxxAgg) else if isrealtime then high(Period = loxxAgg)[1] else high(Period = loxxAgg);
def lowin = if loxxChartTimeframe then
    if loxxRepainting then low else if isrealtime then low[1] else low else
    if loxxRepainting then low(Period = loxxAgg) else if isrealtime then low(Period = loxxAgg)[1] else low(Period = loxxAgg);

def macdValue = ExpAverage(macdsrc, macdFastPeriod) - ExpAverage(macdsrc, macdSlowPeriod);
def linDev = LinDev(ccisrc, cciPeriod);
def nCCI = if linDev == 0 then 0 else (ccisrc - Average(ccisrc, cciPeriod)) / linDev / 0.015;
def changeHi = highin - highin[1];
def changeLo = lowin - lowin[1];

def dmark1 = _dm(loxxPeriod, changeHi, changeLo);
def macd1  = macdValue;
def rsi1   = RSI(Price = rsisrc, Length = rsiPeriod);
def stoch1 = Average(stoch(stochclose, stochhi, stochlo, periodK), smoothK);
def cci1   = nCCI;
def vel1   = _imom(velsrc, VelocityPeriod, VelocityFastPeriod, VelocitySlowPeriod);

def dmark = if !isNaN(dmark1) then dmark1 else dmark[1];
def macd  = if !isNaN(macd1) then macd1 else macd[1];
def rsi   = if !isNaN(rsi1) then rsi1 else rsi[1];
def stoch = if !isNaN(stoch1) then stoch1 else stoch[1];
def cci   = if !isNaN(cci1) then cci1 else cci[1];
def vel   = if !isNaN(vel1) then vel1 else vel[1];

def dmarkCol = dmark > 50;
def macdCol = macd > 0;
def rsiCol = rsi > 50;
def stochCol = stoch > 50;
def cciCol = cci > 0;
def velCol = vel > 0;
plot dmarkLine = if last then na else 1;
plot macdLine = if last then na else 2;
plot rsiLine = if last then na else 3;
plot stochLine = if last then na else 4;
plot cciLine = if last then na else 5;
plot velLine = if last then na else 6;
dmarkLine.AssignValueColor(if dmarkCol then GlobalColor("green") else GlobalColor("red"));
macdLine.AssignValueColor(if macdCol then GlobalColor("green") else GlobalColor("red"));
rsiLine.AssignValueColor(if rsiCol then  GlobalColor("green") else GlobalColor("red"));
stochLine.AssignValueColor(if stochCol then GlobalColor("green") else GlobalColor("red"));
cciLine.AssignValueColor(if cciCol then  GlobalColor("green") else GlobalColor("red"));
velLine.AssignValueColor(if velCol then GlobalColor("green") else GlobalColor("red"));
dmarkLine.SetPaintingStrategy(PaintingStrategy.POINTS);
macdLine.SetPaintingStrategy(PaintingStrategy.POINTS);
rsiLine.SetPaintingStrategy(PaintingStrategy.POINTS);
stochLine.SetPaintingStrategy(PaintingStrategy.POINTS);
cciLine.SetPaintingStrategy(PaintingStrategy.POINTS);
velLine.SetPaintingStrategy(PaintingStrategy.POINTS);
dmarkLine.SetLineWeight(2);
macdLine.SetLineWeight(2);
rsiLine.SetLineWeight(2);
stochLine.SetLineWeight(2);
cciLine.SetLineWeight(2);
velLine.SetLineWeight(2);

def goLong_pre = dmark > 50 and macd > 0 and rsi > 50 and stoch > 50 and cci > 0 and vel > 0;
def goShort_pre = dmark < 50 and macd < 0 and rsi < 50 and stoch < 50 and cci < 0 and vel < 0;

def contSwitch;
    contSwitch = if goLong_pre then 1 else if goShort_pre then -1 else 0;
def goLong  = goLong_pre and (contSwitch-contSwitch[1]);
def goShort = goShort_pre and (contSwitch-contSwitch[1]);

AssignPriceColor(if !colorbars then Color.CURRENT else
                 if goLong_pre then GlobalColor("green") else if goShort_pre then GlobalColor("red") else Color.GRAY);
AssignPriceColor(if !ColorTriggerCandle then Color.CURRENT else
                 if goLong then Color.CYAN else
                 if goShort then Color.MAGENTA else Color.CURRENT);

plot long = if last then na else if contSwitch>0 then 0 else na;
plot short = if last then na else if contSwitch<0 then 7 else na;
long.SetDefaultColor(Color.CYAN);
short.SetDefaultColor(Color.MAGENTA);
long.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
Short.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
long.SetLineWeight(3);
short.SetLineWeight(3);

#//////////////////////////////////////////////////////
#//////////////////UPPER EXTRAS////////////////////////
#//////////////////////////////////////////////////////

input show_bar_level_lines = yes;
def bn = barnumber();

# keep hi/lo of last signal bar

def triggerline_Bull = if bn == 1 or goLong[-1] then na else if goLong then high else triggerline_Bull[1];
def triggerline_Bear = if bn == 1 or goShort[-1] then na else if goShort then low else triggerline_Bear[1];

def Bullish_stp = if bn == 1 or goLong[-1] then na else if goLong then low else Bullish_stp[1];
def Bearish_stp = if bn == 1 or goShort[-1] then na else if goShort then high else Bearish_stp[1];

# plot trigger lines based on def^
plot TL1 = if (!ColorTriggerCandle or !show_bar_level_lines) then na else triggerline_Bull;
TL1.SetDefaultColor(Color.CYAN);

plot TL2 = if (!ColorTriggerCandle or !show_bar_level_lines) then na else triggerline_Bear;
TL2.SetDefaultColor(Color.MAGENTA);

# plot stops

plot TL1stp = if (!ColorTriggerCandle or !show_bar_level_lines) then na else Bullish_stp;
TL1stp.SetDefaultColor(Color.PINK);

plot TL2stp = if (!ColorTriggerCandle or !show_bar_level_lines) then na else Bearish_stp;
TL2stp.SetDefaultColor(Color.PINK);

# Assign Trigger Candle High/Low values

plot h = if goLong then high else na;
h.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
h.SetDefaultColor(Color.CYAN);

plot hstp = if goLong then low else na;
hstp.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
hstp.SetDefaultColor(Color.PINK);

plot l = if goShort then low else na;
l.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
l.SetDefaultColor(Color.MAGENTA);

plot lstp = if goShort then high else na;
lstp.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
lstp.SetDefaultColor(Color.PINK);

# Mark Crossover Arrows

plot crossoverCandle = Crosses(close,TL1,CrossingDirection.ABOVE);

crossoverCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
crossoverCandle.SetDefaultColor(Color.WHITE);

plot crossunderCandle = Crosses(close,TL2,CrossingDirection.BELOW);

crossunderCandle.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
crossunderCandle.SetDefaultColor(Color.WHITE);

# Maximum Risk Pink Dash

input ShowMaxRisk = YES;
input MaxRisk = .4;

def bullMcontinue = if bn == 1 or goLong[-1] then na else if goLong then (high - MaxRisk) else bullMcontinue[1];

def bearMcontinue = if bn == 1 or goShort[-1] then na else if goShort then (low + MaxRisk) else bearMcontinue[1];

plot bullMAX = if (!goLong or !ShowMaxRisk) then na else bullMcontinue;
bullMAX.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bullMAX.SetDefaultColor(Color.PINK);

plot bearMAX = if (!goShort or !ShowMaxRisk) then na else bearMcontinue;
bearMAX.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bearMAX.SetDefaultColor(Color.PINK);

# Maxim Risk from Purchase/crossover Candle White Dash

input ShowMaxRiskfromPurchase = YES;
input MaxRiskfromPurchase = .4;

def MaxActualBULL = if !crossoverCandle then na else (close - MaxRiskfromPurchase);
def MaxActualBEAR = if !crossunderCandle then na else (close + MaxRiskfromPurchase);

def MABU = if bn == 1 or crossoverCandle[-1] then na else if crossoverCandle then MaxActualBull else MABU[1];

def MABE = if bn == 1 or crossunderCandle[-1] then na else if crossunderCandle then MaxActualBEAR else MABE[1];

plot priceMAXup = if (!crossoverCandle or !ShowMaxRiskfromPurchase) then na else MABU;
priceMAXup.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
priceMAXup.SetDefaultColor(Color.WHITE);

plot priceMAXdown = if (!crossunderCandle or !ShowMaxRiskfromPurchase) then na else MABE;
priceMAXdown.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
priceMAXdown.SetDefaultColor(Color.WHITE);

# ////////////////End Upper Code/////////////////////////
 
Is there any way to identify which indicators is what number? (Ex; 1=RSI, etc?)
A list of what each number represents? RSI, TMM, etc?
 
Is there a way to make the bar colors show a dark green when all but maybe 1 or 2 is green and visa versa with red? Instead of all gray. showing a weaker trend but still trending?
 
Is there a way to make the bar colors show a dark green when all but maybe 1 or 2 is green and visa versa with red? Instead of all gray. showing a weaker trend but still trending?
as requested. find below

CSS:
#/ This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#https://www.tradingview.com/v/U30edqhu/
#// © loxx
#indicator("Super 6x: RSI, MACD, Stoch, Loxxer, CCI, & Velocity [Loxx]", shorttitle="S6XRMSDCV [Loxx]",
# Converted by Sam4Cok@Samer800 - 03/2023
declare lower;
input ShowLabel = no;
input ColorTriggerCandle = yes;
input colorbars = yes;  # "Color bars?"
input loxxPeriod = 14;     # 'Loxxer Period'
input loxxChartTimeframe = yes;
input loxxAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Loxxer Resolution'
input loxxRepainting = yes;    # 'Loxxer Allow Repainting?'

input macdSource = close;   # 'MACD Source'
input macdFastPeriod = 12;  # 'MACD Fast Period'
input macdSlowPeriod = 26;  # 'MACD Slow Period'
input macdChartTimeframe = yes;
input macdAgg = AggregationPeriod.FIFTEEN_MIN;    # 'MACD Resolution'
input macdRepainting = yes;  # 'MACD Allow Repainting?'

input rsiSource = close;     # 'RSI Source'
input rsiPeriod = 14;        # 'RSI Period'
input rsiChartTimeframe = yes;
input rsiAgg = AggregationPeriod.FIFTEEN_MIN;    # 'RSI Resolution'
input rsiRepainting = yes;   # 'RSI Allow Repainting?'

input VelocitySource = close;     # 'Velocity Source'
input VelocityPeriod = 32;        # "Velocity Period"
input VelocityFastPeriod = 1;     # "Velocity Fast Period"
input VelocitySlowPeriod = 2;     # "Velocity Slow Period"
input VelChartTimeframe = yes;
input velAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Velocity Resolution'
input velRepainting = yes;         # 'Velocity Allow Repainting?'

input cciSource = close;     # "CCI Source"
input cciPeriod = 14;          # "CCI Period"
input cciChartTimeframe = yes;
input cciAgg = AggregationPeriod.FIFTEEN_MIN;    # 'CCI Resolution'
input cciRepainting = yes;         # 'CCI Allow Repainting?'

input periodK = 14;         # "Stochasitc %K Length"
input smoothK = 1;          # "Stochasitc %K Smoothing"
input periodD = 3;          # "Stochasitc %D Smoothing"
input stochChartTimeframe = yes;
input stochAgg = AggregationPeriod.FIFTEEN_MIN;    # 'Stochasitc Resolution'
input stochRepainting = yes;       # 'Stochasitc Allow Repainting?'

def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
def last = isNaN(close);
def isrealtime = !IsNaN(close);
########### Theme 1################
#DefineGlobalColor("green" , Color.GREEN);
#DefineGlobalColor("red"   , Color.RED);
DefineGlobalColor("green"  , CreateColor(45,210,4));
DefineGlobalColor("red"    , CreateColor(210,4,45));
DefineGlobalColor("dgreen" , CreateColor(27,126,2));
DefineGlobalColor("dred"   , CreateColor(147,2,31));
script nz {
    input data  = close;
    input repl  = 0;
    def ret_val = if isNaN(data) then repl else data;
    plot return = ret_val;
}
# stoch(source, high, low, length) =>
script stoch {
    input src = close;
    input h = high;
    input l = low;
    input len = 14;
    def stoch = 100 * (src - Lowest(l, len)) / (Highest(h, len) - Lowest(l, len));
    plot return = stoch;
}
#_imom(src, length, powSlow, powFast)=>
script _imom {
    input src = close;
    input length = 32;
    input powSlow = 1;
    input powFast = 2;
    def suma;
    def sumwa;
    def imom;
    def sumb;
    def sumwb;
    suma = fold k = 0 to length with p do
           p  + src[k]  * Power(length - k, powSlow);
    sumb = fold k1 = 0 to length with p1 do
           p1 + src[k1] * Power(length - k1, powFast);
    sumwa = fold k2 = 0 to length with p2 do
           p2 + Power(length - k2, powSlow);
    sumwb = fold k3 = 0 to length with p3 do
           p3 + Power(length - k3, powFast);
    imom = (sumb / sumwb - suma / sumwa);
    plot out = imom;
}
#_dm(per, res, rep)=>
script _dm {
    input per = 14;
    input changeHi = 0;
    input changeLo = 0;
    def demax = if changeHi>0 then changeHi else 0;
    def demin = if changeLo<0 then AbsValue(changeLo) else 0;
    def maxma = Average(demax, per);
    def minma = Average(demin, per);
    def loxxer = 100 * maxma / (maxma + minma);
    plot out = loxxer;
}
def macdsrc = if macdChartTimeframe then
    if macdRepainting then macdSource else if isrealtime then macdSource[1] else macdSource else
    if macdRepainting then close(Period = macdAgg) else if isrealtime then close(Period = macdAgg)[1] else close(Period = macdAgg);
def rsisrc = if rsiChartTimeframe then
    if rsiRepainting then rsiSource else if isrealtime then rsiSource[1] else rsiSource else
    if rsiRepainting then close(Period = rsiAgg) else if isrealtime then close(Period = rsiAgg)[1] else close(Period = rsiAgg);
def velsrc = if VelChartTimeframe then
    if velRepainting then VelocitySource else if isrealtime then VelocitySource[1] else VelocitySource else
    if velRepainting then close(Period = velAgg) else if isrealtime then close(Period = velAgg)[1] else close(Period = velAgg);
def ccisrc = if cciChartTimeframe then
    if cciRepainting then cciSource else if isrealtime then cciSource[1] else cciSource else
    if cciRepainting then close(Period = cciAgg) else if isrealtime then close(Period = cciAgg)[1] else close(Period = cciAgg);
def stochhi = if stochChartTimeframe then
    if stochRepainting then high else if isrealtime then high[1] else high else
    if stochRepainting then high(Period = stochAgg) else if isrealtime then high(Period = stochAgg)[1] else high(Period = stochAgg);
def stochlo = if stochChartTimeframe then
    if stochRepainting then low else if isrealtime then low[1] else low else
    if stochRepainting then low(Period = stochAgg) else if isrealtime then low(Period = stochAgg)[1] else low(Period = stochAgg);
def stochclose = if stochChartTimeframe then
    if stochRepainting then close else if isrealtime then close[1] else close else
    if stochRepainting then close(Period = stochAgg) else if isrealtime then close(Period = stochAgg)[1] else close(Period = stochAgg);
def highin = if loxxChartTimeframe then
    if loxxRepainting then high else if isrealtime then high[1] else high else
    if loxxRepainting then high(Period = loxxAgg) else if isrealtime then high(Period = loxxAgg)[1] else high(Period = loxxAgg);
def lowin = if loxxChartTimeframe then
    if loxxRepainting then low else if isrealtime then low[1] else low else
    if loxxRepainting then low(Period = loxxAgg) else if isrealtime then low(Period = loxxAgg)[1] else low(Period = loxxAgg);

def macdValue = ExpAverage(macdsrc, macdFastPeriod) - ExpAverage(macdsrc, macdSlowPeriod);
def linDev = LinDev(ccisrc, cciPeriod);
def nCCI = if linDev == 0 then 0 else (ccisrc - Average(ccisrc, cciPeriod)) / linDev / 0.015;
def changeHi = highin - highin[1];
def changeLo = lowin - lowin[1];

def dmark1 = _dm(loxxPeriod, changeHi, changeLo);
def macd1  = macdValue;
def rsi1   = RSI(Price = rsisrc, Length = rsiPeriod);
def stoch1 = Average(stoch(stochclose, stochhi, stochlo, periodK), smoothK);
def cci1   = nCCI;
def vel1   = _imom(velsrc, VelocityPeriod, VelocityFastPeriod, VelocitySlowPeriod);

def dmark = if !isNaN(dmark1) then dmark1 else dmark[1];
def macd  = if !isNaN(macd1) then macd1 else macd[1];
def rsi   = if !isNaN(rsi1) then rsi1 else rsi[1];
def stoch = if !isNaN(stoch1) then stoch1 else stoch[1];
def cci   = if !isNaN(cci1) then cci1 else cci[1];
def vel   = if !isNaN(vel1) then vel1 else vel[1];

def dmarkCol = dmark > 50;
def macdCol = macd > 0;
def rsiCol = rsi > 50;
def stochCol = stoch > 50;
def cciCol = cci > 0;
def velCol = vel > 0;

plot dmarkLine = if last then na else 1;
plot macdLine = if last then na else 2;
plot rsiLine = if last then na else 3;
plot stochLine = if last then na else 4;
plot cciLine = if last then na else 5;
plot velLine = if last then na else 6;
dmarkLine.AssignValueColor(if dmarkCol then GlobalColor("green") else GlobalColor("red"));
macdLine.AssignValueColor(if macdCol then GlobalColor("green") else GlobalColor("red"));
rsiLine.AssignValueColor(if rsiCol then  GlobalColor("green") else GlobalColor("red"));
stochLine.AssignValueColor(if stochCol then GlobalColor("green") else GlobalColor("red"));
cciLine.AssignValueColor(if cciCol then  GlobalColor("green") else GlobalColor("red"));
velLine.AssignValueColor(if velCol then GlobalColor("green") else GlobalColor("red"));
dmarkLine.SetPaintingStrategy(PaintingStrategy.POINTS);
macdLine.SetPaintingStrategy(PaintingStrategy.POINTS);
rsiLine.SetPaintingStrategy(PaintingStrategy.POINTS);
stochLine.SetPaintingStrategy(PaintingStrategy.POINTS);
cciLine.SetPaintingStrategy(PaintingStrategy.POINTS);
velLine.SetPaintingStrategy(PaintingStrategy.POINTS);
dmarkLine.SetLineWeight(2);
macdLine.SetLineWeight(2);
rsiLine.SetLineWeight(2);
stochLine.SetLineWeight(2);
cciLine.SetLineWeight(2);
velLine.SetLineWeight(2);

def goLong_pre = dmark > 50 and macd > 0 and rsi > 50 and stoch > 50 and cci > 0 and vel > 0;
def goShort_pre = dmark < 50 and macd < 0 and rsi < 50 and stoch < 50 and cci < 0 and vel < 0;

def contSwitch;
    contSwitch = if goLong_pre then 1 else if goShort_pre then -1 else 0;
def goLong  = goLong_pre and (contSwitch-contSwitch[1]);
def goShort = goShort_pre and (contSwitch-contSwitch[1]);

def Strength = nz(dmarkCol) + nz(macdCol) + nz(rsiCol) + nz(stochCol) + nz(cciCol) + nz(velCol);

def ExtUp = Strength>4;
def Up    = Strength>3;
def ExtDn = Strength<1;
def Dn    = Strength<3;

AssignPriceColor(if !colorbars then Color.CURRENT else
                 if ExtUp then Color.GREEN else
                 if    Up then Color.DARK_GREEN else
                 if ExtDn then Color.RED else
                 if    Dn then Color.DARK_RED else Color.GRAY);
AssignPriceColor(if !ColorTriggerCandle then Color.CURRENT else
                 if goLong then Color.CYAN else
                 if goShort then Color.MAGENTA else Color.CURRENT);

plot long = if last then na else if contSwitch>0 then 0 else na;
plot short = if last then na else if contSwitch<0 then 7 else na;
long.SetDefaultColor(Color.CYAN);
short.SetDefaultColor(Color.MAGENTA);
long.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
Short.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
long.SetLineWeight(3);
short.SetLineWeight(3);

AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), dmarkLine[2], "Loxxer", dmarkLine.TakeValueColor(), no);
AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), macdLine[2] , "MACD ", macdLine.TakeValueColor(), no);
AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), rsiLine[2]  , "RSI", rsiLine.TakeValueColor(), no);
AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), stochLine[2], "Stoch", stochLine.TakeValueColor(), yes);
AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), cciLine[2]  ,  "CCI", cciLine.TakeValueColor(), yes);
AddChartBubble(ShowLabel and isNaN(close) and isNaN(close[1]), velLine[2]  , "Velocity", velLine.TakeValueColor(), yes);
#---- END of Code
 
I was trying to modify the lower indicator to change the color of the dots to either magenta or cyan when RSI was oversold/overbought, or other indicators where in oversold/overbought condition, but I was not successful. I wasn't able to make it more than green or red dots. If you could add these "oversold/overbought" dots, that would be cool.
 
Last edited:
Awesome!! It is really good. Is there a non-MTF version that would work in any time frame?

The script does allow you to choose the timeframe.
If you set your timeframes to whatever chart you are working on, then voilà it is a non-MTF
 
Last edited:
From Strategy Based on EMAs, TSI, MACD, and Premarket Highs/Lows For ThinkOrSwim,
https://usethinkscript.com/threads/...d-premarket-highs-lows-for-thinkorswim.10866/

here is an EMA label for a Super 7. The right lengths could be easily adjusted in the code. It looked like adding TSI, but it did not like it. For the Ichimoku Cloud, this is out of my league. So if someone could adjust the code with TSI and Ichomku Cloud for a Super 9 that would be great. I tried to just send a link, but I cannot so here is the code:
 
Last edited by a moderator:
From Strategy Based on EMAs, TSI, MACD, and Premarket Highs/Lows For ThinkOrSwim,
https://usethinkscript.com/threads/...d-premarket-highs-lows-for-thinkorswim.10866/

here is an EMA label for a Super 7. The right lengths could be easily adjusted in the code. It looked like adding TSI, but it did not like it. For the Ichimoku Cloud, this is out of my league. So if someone could adjust the code with TSI and Ichomku Cloud for a Super 9 that would be great. I tried to just send a link, but I cannot so here is the code:

Note: requests to add even more to this indicator are unlikely to be met. This indicator is complex bordering on freezing up your app. Adding more code could put it over the edge.


What Indicators Pair Best With The Super 6x Indicator
All trending strategies work best when combined with:
  • Cycle Indicator
  • Support & Resistance (can be hand-drawn or a study)
  • Volume
https://usethinkscript.com/threads/...ocity-loxx-for-thinkorswim.14670/#post-122706

The workaround to your request would be to simply add another dashboard below this indicator for your TSI and Ichomku Cloud.
Here is a Ichomku dashboard to start you on your quest:
https://usethinkscript.com/threads/ichimoku-macd-and-psar-dashboard-for-thinkorswim.14928/
 
Last edited:
Hello @MerryDay Thanks for your reply but consider me as a newbie as I've already gone through the post you mentioned and hence I asked specifically on how to use it. When you say add 3 times, does it mean that there will be 3 lower studies of the same super6 indicator? Since the instructions does not mention what settings to select from indicator settings (specifically "macd chart timeframe" and "macd agg"), I'm still confused and hence I asked questions by giving my step by step instructions that I followed. Appreciate you response.
 
When you say add 3 times, does it mean that there will be 3 lower studies of the same super6 indicator?
This is a trend / momentum indicator.
Best practices dictate that trend / momentum indicators be reviewed on three timeframes.
So yes, there should be 3 lower studies.

Since the instructions does not mention what settings to select from indicator settings (specifically "macd chart timeframe" and "macd agg"), I'm still confused and hence I asked questions by giving my step by step instructions that I followed. Appreciate you response.
You need to choose your timeframes based on how you trade.
It is beyond the scope of this thread to provide in-depth instructions on the proper use of trend / momentum indicators on multiple timeframes.
There are abundant resources on the internet, explaining this basic tenet of trading.

VIP members can see an example of multiple timeframe trading here:
https://usethinkscript.com/threads/buy-the-dip-basic-chart-setup.14773/

and why it is critical here:
https://usethinkscript.com/threads/is-your-strategy-missing-long-term-trend-verification.14770/

read more:
https://usethinkscript.com/threads/backtesting-a-tos-strategy.10942/#post-123766
 
Last edited:
Everything You Want To Know About Super 6x And Were Afraid To Ask.
When oscillators cross their midpoint, they are seen as trending.
This indicator displays oscillators above their midpoint (green) or below (red).

Trend is one of the single most important indicators in trading.
Preferably, you want to add this to your chart three times.
1. For the highest timeframe (weekly / monthly maybe daily if scalping)
Bullish trend on the highest timeframe tells you that this stock is going places.
2. For the middle timeframe. You want to see a bearish trend.
This represents the buying opportunity.
3. For your lowest timeframe. You want to see those lines turning green.
This stock is ready to take off.

rU3528a.png

*collinear = https://usethinkscript.com/threads/...nt-to-successful-trading-in-thinkorswim.6114/

The display seen with this indicator is called a dashboard.
Traditionally, dashboards are used as traffic lights. The more green a dashboard is, then the more bullish.

The lines on the chart are identified as follows:
1st line Loxxer
2nd line MACD
3rd line RSI
4th line Stochasitc
5th line CCI
6th line Velocity

The purple triangles indicate that all 6 indicators are currently red.
The blue triangles indicate that all 6 are in the green.
Conversely, the painted bars.....purple indicates the first candle in which all 6 ind. have gone red (for a short opportunity)
and the blue candle indicates the first candle in which all 6 have gone green (for a long opportunity).
Grey colored candles indicate that one or more of the indicators are not in agreement with the others (in other words, somewhat neutral price action).
Red candles = strong downtrend, Green = strong uptrend

The Original Study can be found: https://usethinkscript.com/threads/...ocity-loxx-for-thinkorswim.14670/#post-120946
An interesting variation of this indicator: https://usethinkscript.com/threads/...ocity-loxx-for-thinkorswim.14670/#post-121572

Install instructions: https://usethinkscript.com/threads/how-to-import-existing-thinkscript-code-on-thinkorswim.10/
study link: http://tos.mx/ldOfefP Click here for --> Easiest way to load shared links
Start out with extended hours off.

Scans & Watchlists: No. This indicator is too complex for use anywhere other than plotting a chart.
The workaround is to scan for each oscillator separately

This indicator does not work on Tick or Renko charts
No, there is no workaround.

Note: requests to add even more to this indicator are unlikely to be met. This indicator is complex bordering on freezing up your app. Adding more code could put it over the edge.


What Indicators Pair Best With The Super 6x Indicator
All trending strategies work best when combined with:
  • Cycle Indicator
  • Support & Resistance (can be hand-drawn or a study)
  • Volume
So, to be clear, you put this on your chart, (minute chart) 3 times... and on one you have the aggregation set to 1 Minute, the second you put the agg on for middle let's say 1 hour and the third you weekly? All three aggregations on the 1 minute chart?
OR you put the 1 agg on the minute chart... then have a second chart "style" for the 1 hour and another for the weekly? In other words, you have just one indicator set for a minute, then switch to the 1 hour that just has one indicator set for 1 hour agg and the third with one indicator set with an agg of weekly on the weekly chart.... ?
 
So, to be clear, you put this on your chart, (minute chart) 3 times... and on one you have the aggregation set to 1 Minute, the second you put the agg on for middle let's say 1 hour and the third you weekly? All three aggregations on the 1 minute chart?
Yes, to save real estate; you can put all three on one chart.

OR you put the 1 agg on the minute chart... then have a second chart "style" for the 1 hour and another for the weekly? In other words, you have just one indicator set for a minute, then switch to the 1 hour that just has one indicator set for 1 hour agg and the third with one indicator set with an agg of weekly on the weekly chart.... ?
As we have discussed in VIP here:
https://usethinkscript.com/threads/buy-the-dip-basic-chart-setup.14773/

and here:
https://usethinkscript.com/threads/is-your-strategy-missing-long-term-trend-verification.14770/

We are looking for very different information on each timeframe; so members who can afford the real estate, will choose to dedicate a separate chart to each of their aggregations.

read more:
https://usethinkscript.com/threads/backtesting-a-tos-strategy.10942/#post-123766
 
Last edited:
Yes, to save real estate; you can put all three on one chart.


As we have discussed in VIP here:
https://usethinkscript.com/threads/buy-the-dip-basic-chart-setup.14773/

and here:
https://usethinkscript.com/threads/is-your-strategy-missing-long-term-trend-verification.14770/

We are looking for very different information on each timeframe; so members who can afford the real estate, will choose to dedicate a separate chart to each of their aggregations.

read more:
https://usethinkscript.com/threads/backtesting-a-tos-strategy.10942/#post-123766
Yes thats what I did. Thanks.
 
Is there a way to get this to work on the mobile app as well? It looks great on my desktop and laptop, but it doesn't show anything on the mobile app. Thank you and awesome work.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
377 Online
Create Post

Similar threads

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.
Back
Top