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

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.
Secondary aggregations are not supported on the mobile app.
If you set the aggregations to be equal to your chart display, maybe? you could get something to display.
But most likely, this indicator will not be compatible with the mobile app.
 

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

zYs5ll2.png

Author Message:
Super 6x: RSI , MACD , Stoch , Loxxer, CCI , & Velocity is a combination of 6 indicators into one histogram. This includes the option to allow repainting and not to repaint.

CODE:
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 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);


#---- END of Code
Hello Samer,

Your use of individual Aggregations, ChartTimeFrame,& RePainting are redundant! You can use just one input of each to do the same function for each indicator just makes it easier to adjust the inputs than to have to scroll down the list for each indicator. Just saying!
 
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.

Not sure, if this is still needed but this should do the trick.


Ruby:
rsiLine.AssignValueColor(if rsiCol  and RSI < 70 then GlobalColor("green") else
                         if !rsiCol and RSI > 30 then GlobalColor("red") else
                         if rsiCol  and RSI > 70 then Color.MAGENTA else Color.CYAN);
 
Just want to convert these unknown future values to black (If someone can please help) --

1721992934563.png


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
declare lower;

input ColorTriggerCandle = yes;
input colorbars = yes;  # "Color bars?"
input loxxPeriod = 14;     # 'Loxxer Period'
input loxxChartTimeframe = yes;
input loxxAgg = AggregationPeriod.TWO_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.TWO_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.TWO_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.TWO_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.TWO_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.TWO_MIN;    # 'Stochasitc Resolution'
input stochRepainting = yes;       # 'Stochasitc Allow Repainting?'

#/ This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © QuantraAI
#indicator("Scalper's Volatility Filter", "SVF", false, timeframe = '', timeframe_gaps = false)
# Converted by Sam4Cok@Samer800    - 02/2024


input DisplayType = {default "Crosses", "Histogram"};     # " Display Type"
input BaseAtrLength = 13;             # "Base ATR Length"
input SecondAtrLength = 40;           # "Second ATR Length"
input BaseStdDevLength = 20;          # "Base StdDev"
input SecondStdDevLength = 100;       # "Second StdDev"
input adxSmoothing  = 14;             # "ADX Smoothing"
input diLength   = 14;                # "DI Length"
input adxBaseline = 25;               # "ADX Baseline"
input RegressionLengt  = 20;          # "Regression Length"
input RegressionSensitivity  = 350;   # "Regression Sensitivity"
input BarColoring    = no;            # "Bar Coloring"
input showLabel      = no;


def na = Double.NaN;
def last = IsNaN(close);
def his = DisplayType == DisplayType."Histogram";
#//    Functions    //
#// Modified Damiani Voltemter                // Credit to @xinolia
script DV {
    input src = close;
    input vis_atr = 13;
    input vis_std = 20;
    input sed_atr = 40;
    input sed_std = 100;
    def lag_s_K = 0.5;
    def vol;
    def s1 = if IsNaN(vol[1]) then 0 else vol[1];
    def s3 = if IsNaN(vol[3]) then 0 else vol[3];
    def visAtr = ATR(Length = vis_atr);
    def sedAtr = ATR(Length = sed_atr);
    def visStd = StDev(src, vis_std);
    def sedStd = StDev(src, sed_std);
    vol = visAtr / sedAtr + lag_s_K * (s1 - s3);
    def anti_thres = visStd / sedStd;
    def t1 = 1.4 - anti_thres;
    def t = t1 - vol;
    def DV = -t * 100;
    plot out = if IsNaN(DV) then 0 else DV;
}
#// Average Directional Index
script nADX {
    input dilen = 14;
    input adxlen = 14;
    def averageType = AverageType.WILDERS;
    def hiDiff = high - high[1];
    def loDiff = low[1] - low;
    def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
    def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
    def ATR = MovingAverage(averageType, TrueRange(high, close, low), dilen);
    def "DI+" = 100 * MovingAverage(averageType, plusDM, dilen) / ATR;
    def "DI-" = 100 * MovingAverage(averageType, minusDM, dilen) / ATR;
    def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
    def nADX = MovingAverage(averageType, DX, adxlen);
    plot out = nADX;
}
#// Linear Regression Dispersion
script dispersion {
    input period = 20;
    input TrSens = 350;
    def linRegLine = Inertia(close, period);
    def tes = StDev(close - linRegLine, period);
    def dispersion = (tes - Median(tes, TrSens)) / 2;
    plot out = dispersion;
}

# /    Calculations    //
def dvm = DV(close, BaseAtrLength, BaseStdDevLength, SecondAtrLength, SecondStdDevLength);
def sig = (nADX(diLength, adxSmoothing) - adxBaseline) * 3;
def dis = dispersion(RegressionLengt, RegressionSensitivity);
def av  = (dvm + sig + dis) / 3;
def clr = if av > 0 then if av > av[1] then 2 else -2 else
          if av < 0 then if av < av[1] then 1 else -1 else 0;

############################ORIG TREND_METER########################################;

def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;

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;
def upup = clr == 2;
def updown = clr == -2;
def downdown = clr == 1;
def downup = clr == -1;


plot dmarkLine = if last then na else 2;
plot macdLine = if last then na else 3;
plot rsiLine = if last then na else 4;
plot stochLine = if last then na else 5;
plot cciLine = if last then na else 6;
plot velLine = if last then na else 7;
plot pavHist = if his then av else 9;#, "Average Volatility", clr, 3, disp)
plot pavHist2 = if his then av else 0;

pavHist.AssignValueColor(if upup then Color.DARK_ORANGE else
                         if updown then Color.DARK_ORANGE else
                         if downdown then Color.DARK_GRAY else
                         if downup then Color.YELLOW else Color.BLACK);

pavHist2.AssignValueColor(if upup then Color.DARK_ORANGE else
                         if updown then Color.DARK_ORANGE else
                         if downdown then Color.DARK_GRAY else
                         if downup then Color.YELLOW else Color.BLACK);

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"));

pavHist.SetPaintingStrategy(PaintingStrategy.POINTS);
pavHist2.SetPaintingStrategy(PaintingStrategy.POINTS);
dmarkLine.SetPaintingStrategy(PaintingStrategy.POINTS);
macdLine.SetPaintingStrategy(PaintingStrategy.POINTS);
rsiLine.SetPaintingStrategy(PaintingStrategy.POINTS);
stochLine.SetPaintingStrategy(PaintingStrategy.POINTS);
cciLine.SetPaintingStrategy(PaintingStrategy.POINTS);
velLine.SetPaintingStrategy(PaintingStrategy.POINTS);

pavHist.SetLineWeight(4);
pavHist2.SetLineWeight(4);
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]);



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



#---- END of Code
 
Last edited by a moderator:
Just want to convert these unknown future values to black (If someone can please help) --

change these two lines from:
plot pavHist = if his then av else 9;#, "Average Volatility", clr, 3, disp)
plot pavHist2 = if his then av else 0;


to:
plot pavHist = if last then na else if his then av else 9;#, "Average Volatility", clr, 3, disp)
plot pavHist2 = if last then na else if his then av else 0;
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
400 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