MCDX indicator For ThinkOrSwim

I like to use the MCDX indicator in Trading View,
https://www.tradingview.com/script/u2dIgVpN-M2J-Indicator-MCDX/
it very useful to track the smart money flow, but it is not exist in TOS,
check out the code below.

CSS:
#// © Mango2Juice
#// MCDX is an indicator based on mutilple relative strength index (RSI) with different period, then classify into 3 categories - Retailer, Hot Money and Banker
#// Green - Retailer
#// Yellow - Hot money
#// Red - Banker
#// the higher and many reds are more preferable
# study("[M2J] Indicator | MCDX", "MCDX")
# Converted by Sam4Cok@Samer800 - 11/2022
declare lower;
input RSIBaseBanker       = 50; # "Banker Base",           minval = 10)
input RSIPeriodBanker     = 50; # "Banker RSI Period",     minval = 10)
input RSIBaseHotMoney     = 30; # "Hot Money RSI Base",    minval = 10)
input RSIPeriodHotMoney   = 40; # "Hot Money RSI Period",  minval = 10)
input SensitivityBanker   = 1.5;# "Sensitivity Banker",    minval = 0.1, step = 0.1)
input SensitivityHotMoney = 0.7;# "Sensitivity Hot Money", minval = 0.1, step = 0.1)

def na = Double.NaN;
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
input sensitivity = 0;
input rsiPeriod = 14;
input rsiBase = 0;
    def rsi = sensitivity * (rsi(Length=rsiPeriod) - rsiBase);
    def nRSI;
    if rsi > 20 {
        nrsi = 20;
    } else {  
 if rsi < 0 {
        nrsi = 0;
    } else {
        nrsi = rsi;
}}
   plot result = nrsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);

plot "5" = if(isNaN(close),na,5);#, "5" , color.silver,  2, editable = false)
"5".SetDefaultColor(Color.GRAY);
"5".SetLineWeight(2);
plot "10" = if(isNaN(close),na,10);#, "10", color.fuchsia, 2, editable = false)
"10".SetDefaultColor(Color.MAGENTA);
"10".SetLineWeight(2);
plot "15" = if(isNaN(close),na,15);#, "15", color.silver,  2, editable = false)
"15".SetDefaultColor(Color.GRAY);
"15".SetLineWeight(2);

plot Banker = if(isNaN(close),na,rsi_Banker);#,   "Banker",    #ff0000, 6, plot.style_histogram)
Banker.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Banker.SetDefaultColor(CreateColor(255,0,0));

plot HotMoney = if(isNaN(close),na,rsi_HotMoney);#, "Hot Money", #d8c200, 6, plot.style_histogram)
HotMoney.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
HotMoney.SetDefaultColor(CreateColor(216,194,0));

plot Retailer = if(isNaN(close),na,20);# "Retailer",  #005e07, 6, plot.style_histogram)
Retailer.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Retailer.SetDefaultColor(CreateColor(0,94,7));

#--- END Code
 
Last edited by a moderator:
MCDX is an indicator based on mutilple relative strength index (RSI) with different period, then classify into 3 categories - Retailer, Hot Money and Banker
  • Green - Retailer
  • Yellow - Hot money
  • Red - Banker

the higher and many reds are more preferable

the link:https://www.tradingview.com/script/u2dIgVpN-M2J-Indicator-MCDX/
find below

https://usethinkscript.com/threads/mcdx-indicator-for-thinkorswim.12010/#post-111741


CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © Mango2Juice
#// MCDX is an indicator based on mutilple relative strength index (RSI) with different period, then classify into 3 categories - Retailer, Hot Money and Banker
#// Green - Retailer
#// Yellow - Hot money
#// Red - Banker
#// the higher and many reds are more preferable
#study("[M2J] Indicator | MCDX", "MCDX")
# converted by Sam4Cok@Samer800
declare lower;
input rsiBaseBanker       = 50;        # "Banker Base"
input rsiPeriodBanker     = 50;        # "Banker RSI Period"
input rsiBaseHotMoney     = 30;        # "Hot Money RSI Base"
input rsiPeriodHotMoney   = 40;        # "Hot Money RSI Period"
input SensitivityBanker   = 1.5;       # "Sensitivity Banker"
input SensitivityHotMoney = 0.7;       # "Sensitivity Hot Money"

def na = Double.NaN;
def last = isNaN(close);
#-- Color--
DefineGlobalColor("Retail", CreateColor(0,94,7));
DefineGlobalColor("Hot", CreateColor(216,194,0));
DefineGlobalColor("Banker", CreateColor(255,0,0));
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
input sensitivity = 1.5;
input rsiPeriod = 50;
input rsiBase = 50;
    def rsiValue;
    def rsi_ = rsi(Price=close,Length= rsiPeriod);
    def nRSI = sensitivity * (rsi_ - rsiBase);

    if nRSI > 20 {
        rsiValue = 20;
    } else
    if nRSI < 0 {
        rsiValue = 0;
    } else {
        rsiValue = nRSI;
}
    plot out = rsiValue;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);

plot "5" = if last then na else 5;
plot "10" = if last then na else 10;
plot "15" = if last then na else 15;
"5".SetDefaultColor(Color.WHITE);
"10".SetDefaultColor(Color.MAGENTA);
"15".SetDefaultColor(Color.WHITE);

plot Banker = rsi_Banker;                    # "Banker"
plot HotMoney = rsi_HotMoney;                # "Hot Money"
plot Retailer = if last then na else 20;     # "Retailer"
Retailer.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
HotMoney.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Banker.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);


Retailer.SetDefaultColor(GlobalColor("Retail"));
HotMoney.SetDefaultColor(GlobalColor("Hot"));
Banker.SetDefaultColor(GlobalColor("Banker"));



#-- END of CODE
 
Hi everyone,

I am trying to use the MCDX code to scan for stocks where the "Banker" value was zero the day prior, and now it is greater than zero. However, whenever I try and use the code in the scanner, the scanner crashes. May you please help me with this? Thank you very much.
 
Last edited by a moderator:
The green (retail) is maxed on this indicator in every time frame I've looked at. I think removing the green part of the indicator wouldn't change its utility at all.
 
The green (retail) is maxed on this indicator in every time frame I've looked at. I think removing the green part of the indicator wouldn't change its utility at all.
@autoloader that fixed the issue, I am now able to scan for the Banker values, thank you very much, this is very helpful.
Code:
declare lower;
input rsiBaseBanker       = 50;        # "Banker Base"
input rsiPeriodBanker     = 50;        # "Banker RSI Period"
input SensitivityBanker   = 1.5;       # "Sensitivity Banker"

def na = Double.NaN;
def last = isNaN(close);
#-- Color--
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
input sensitivity = 1.5;
input rsiPeriod = 50;
input rsiBase = 50;
    def rsiValue;
    def rsi_ = rsi(Price=close,Length= rsiPeriod);
    def nRSI = sensitivity * (rsi_ - rsiBase);

    if nRSI > 20 {
        rsiValue = 20;
    } else
    if nRSI < 0 {
        rsiValue = 0;
    } else {
        rsiValue = nRSI;
}
    plot out = rsiValue;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);

plot "5" = if last then na else 5;
plot "10" = if last then na else 10;
plot "15" = if last then na else 15;

plot Banker = rsi_Banker;                    # "Banker"
Banker.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);





#-- END of CODE
 
The green (retail) is maxed on this indicator in every time frame I've looked at. I think removing the green part of the indicator wouldn't change its utility at all.

@autoloader:

It would appear that the scale of this indicator tops out at 20 and the "Retail" is set to 20...Leaving or removing the "Retail" has no effect on the "Hot Money" or "Banker" RSI calculations...Below please find an edited version of the indicator with the "Retail" removed...

Code:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © Mango2Juice
#// MCDX is an indicator based on mutilple relative strength index (RSI) with different period, then classified into 2 categories - Hot Money and Banker
#// Yellow - Hot money
#// Red - Banker
#// the higher and many reds are more preferable
#study("[M2J] Indicator | MCDX", "MCDX")
# converted by Sam4Cok@Samer800

declare lower;

input rsiBaseBanker       = 50;        # "Banker Base"
input rsiPeriodBanker     = 50;        # "Banker RSI Period"
input rsiBaseHotMoney     = 30;        # "Hot Money RSI Base"
input rsiPeriodHotMoney   = 40;        # "Hot Money RSI Period"
input SensitivityBanker   = 1.5;       # "Sensitivity Banker"
input SensitivityHotMoney = 0.7;       # "Sensitivity Hot Money"

def na = Double.NaN;
def last = isNaN(close);

#-- Color--
DefineGlobalColor("Hot", CreateColor(216,194,0));
DefineGlobalColor("Banker", CreateColor(255,0,0));

script rsi_function {
input sensitivity = 1.5;
input rsiPeriod = 50;
input rsiBase = 50;
    def rsiValue;
    def rsi_ = rsi(Price=close,Length= rsiPeriod);
    def nRSI = sensitivity * (rsi_ - rsiBase);

    if nRSI > 20 {
        rsiValue = 20;
    } else
    if nRSI < 0 {
        rsiValue = 0;
    } else {
        rsiValue = nRSI;
}
    plot out = rsiValue;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);

plot "5" = if last then na else 5;
plot "10" = if last then na else 10;
plot "15" = if last then na else 15;
"5".SetDefaultColor(Color.WHITE);
"10".SetDefaultColor(Color.MAGENTA);
"15".SetDefaultColor(Color.WHITE);

plot Banker = rsi_Banker;
Banker.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Banker.SetDefaultColor(GlobalColor("Banker"));

plot HotMoney = rsi_HotMoney;
HotMoney.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
HotMoney.SetDefaultColor(GlobalColor("Hot"));

Hope this helps...

Good Luck and Good Trading :cool:
 
@autoloader:

It would appear that the scale of this indicator tops out at 20 and the "Retail" is set to 20...Leaving or removing the "Retail" has no effect on the "Hot Money" or "Banker" RSI calculations...Below please find an edited version of the indicator with the "Retail" removed...

Code:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © Mango2Juice
#// MCDX is an indicator based on mutilple relative strength index (RSI) with different period, then classified into 2 categories - Hot Money and Banker
#// Yellow - Hot money
#// Red - Banker
#// the higher and many reds are more preferable
#study("[M2J] Indicator | MCDX", "MCDX")
# converted by Sam4Cok@Samer800

declare lower;

input rsiBaseBanker       = 50;        # "Banker Base"
input rsiPeriodBanker     = 50;        # "Banker RSI Period"
input rsiBaseHotMoney     = 30;        # "Hot Money RSI Base"
input rsiPeriodHotMoney   = 40;        # "Hot Money RSI Period"
input SensitivityBanker   = 1.5;       # "Sensitivity Banker"
input SensitivityHotMoney = 0.7;       # "Sensitivity Hot Money"

def na = Double.NaN;
def last = isNaN(close);

#-- Color--
DefineGlobalColor("Hot", CreateColor(216,194,0));
DefineGlobalColor("Banker", CreateColor(255,0,0));

script rsi_function {
input sensitivity = 1.5;
input rsiPeriod = 50;
input rsiBase = 50;
    def rsiValue;
    def rsi_ = rsi(Price=close,Length= rsiPeriod);
    def nRSI = sensitivity * (rsi_ - rsiBase);

    if nRSI > 20 {
        rsiValue = 20;
    } else
    if nRSI < 0 {
        rsiValue = 0;
    } else {
        rsiValue = nRSI;
}
    plot out = rsiValue;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);

plot "5" = if last then na else 5;
plot "10" = if last then na else 10;
plot "15" = if last then na else 15;
"5".SetDefaultColor(Color.WHITE);
"10".SetDefaultColor(Color.MAGENTA);
"15".SetDefaultColor(Color.WHITE);

plot Banker = rsi_Banker;
Banker.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Banker.SetDefaultColor(GlobalColor("Banker"));

plot HotMoney = rsi_HotMoney;
HotMoney.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
HotMoney.SetDefaultColor(GlobalColor("Hot"));

Hope this helps...

Good Luck and Good Trading :cool:
Thank you very much @netarchitech
 
Here is my take on this same indicator, it's been helpful for my trading.
I added in the moving averages that other MCDX variants on TradingView included.
Includes labels showing the percentage breakdown of the 3 groups and dynamic coloring.

Code:
# MultiColor DegenX Indicator
declare lower;
# Green/Cyan - Retailer / Locked
# Yellow/Gray - Hot money / Float
# Red/Pink - Banker / Profit
# Colors change if a group becomes weaker as it's value falls below the moving average

input banker_base = 50;
input banker_period = 50;
input hotmoney_base = 30;
input hotmoney_period = 40;
input banker_sens = 1.5;
input hotmoney_sens = 0.7;
input show_pct = yes;
input show_labels = yes;
input show_pma = yes;
input show_fma = no;
input show_lma = yes;

# Base value
def BASE = 20.0;

# RSI calculations
def banker_rsi = banker_sens * (RSI(price = close, length = banker_period).RSI - banker_base);
def banker_rsi_capped = if banker_rsi > 20 then 20 else if banker_rsi < 0 then 0 else banker_rsi;

def hotmoney_rsi = hotmoney_sens * (RSI(price = close, length = hotmoney_period).RSI - hotmoney_base);
def hotmoney_rsi_capped = if hotmoney_rsi > 20 then 20 else if hotmoney_rsi < 0 then 0 else hotmoney_rsi;

# Component Values
def pc_val = banker_rsi_capped;
def fc_val = hotmoney_rsi_capped;

# Moving Averages
def base_length = 10;
def sma_pc = ExpAverage(pc_val, base_length);
def sma_fc = ExpAverage(fc_val - pc_val, base_length);
def sma_lc = ExpAverage(BASE - fc_val, base_length);

# Percentages
def profit_pct = Round((pc_val / BASE) * 100, 1);
def float_pct = Round(((fc_val - pc_val) / BASE) * 100, 1);
def locked_pct = Round(((BASE - fc_val) / BASE) * 100, 1);

# Component state definitions
def profit_state = pc_val >= sma_pc;
def float_state = (fc_val - pc_val) >= sma_fc;
def locked_state = (BASE - fc_val) >= sma_lc;

# Trading conditions
def banker_building = pc_val > 0 and pc_val > sma_pc and pc_val[1] == 0 and close > open;
def bank_pump = sma_pc > 0 and pc_val > sma_pc and close > open;
def banker_distribution = pc_val < sma_pc and pc_val[1] > pc_val;
def retail_trap = pc_val == 0 and close < open;

# Reference Lines
plot RefLine5 = 5;
plot RefLine10 = 10;
plot RefLine15 = 15;

RefLine5.SetDefaultColor(Color.DARK_GRAY);
RefLine10.SetDefaultColor(Color.DARK_GRAY);
RefLine15.SetDefaultColor(Color.DARK_GRAY);

RefLine5.SetStyle(Curve.SHORT_DASH);
RefLine10.SetStyle(Curve.SHORT_DASH);
RefLine15.SetStyle(Curve.SHORT_DASH);

# Moving Average Lines
plot MA_Profit = if show_pma then sma_pc else Double.NaN;
plot MA_Float = if show_fma then sma_fc else Double.NaN;
plot MA_Locked = if show_lma then sma_lc else Double.NaN;

MA_Profit.SetDefaultColor(Color.BLUE);
MA_Float.SetDefaultColor(Color.GRAY);
MA_Locked.SetDefaultColor(Color.MAGENTA);
MA_Profit.SetLineWeight(2);
MA_Float.SetLineWeight(2);
MA_Locked.SetLineWeight(2);

# Labels
AddLabel(show_pct,
    "Locked: " + locked_pct + "%",
    if locked_state then Color.CYAN else Color.GREEN
);
AddLabel(show_pct,
    "Float: " + float_pct + "%",
    if float_state then Color.YELLOW else CreateColor(128, 128, 0)
);
AddLabel(show_pct,
    "Profit: " + profit_pct + "%",
    if profit_state then Color.RED else Color.LIGHT_RED
);

# Condition Labels
AddLabel(show_labels and banker_building, "ACCUM", Color.CYAN);
AddLabel(show_labels and bank_pump, "PUMP", Color.YELLOW);
AddLabel(show_labels and banker_distribution, "DIST", Color.RED);
AddLabel(show_labels and retail_trap, "TRAP", Color.MAGENTA);

############################################################
# Plotting and Fill Section
############################################################

# Main value plots with Area style
def is_future_bar = isNaN(close);
plot ProfitLine = if is_future_bar then Double.NaN else pc_val;
plot FloatLine = if is_future_bar then Double.NaN else fc_val;
plot BaseLine = if is_future_bar then Double.NaN else BASE;
plot ZeroLine = 0;

# Color definitions
DefineGlobalColor("StrongProfit", Color.RED);
DefineGlobalColor("WeakProfit", CreateColor(255, 192, 192));
DefineGlobalColor("StrongFloat", Color.LIGHT_GRAY);
DefineGlobalColor("WeakFloat", Color.YELLOW);
DefineGlobalColor("StrongLocked", Color.CYAN);
DefineGlobalColor("WeakLocked", Color.LIGHT_GREEN);

# Set Area style for main plots
ProfitLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
FloatLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
BaseLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

ProfitLine.SetLineWeight(3);
FloatLine.SetLineWeight(3);
BaseLine.SetLineWeight(3);

# Line colors for main plots based on states
ProfitLine.AssignValueColor(if profit_state then GlobalColor("StrongProfit") else GlobalColor("WeakProfit"));
FloatLine.AssignValueColor(if float_state then GlobalColor("StrongFloat") else GlobalColor("WeakFloat"));
BaseLine.AssignValueColor(if locked_state then GlobalColor("StrongLocked") else GlobalColor("WeakLocked"));
MCDX.png
 
Last edited:
Here is my take on this same indicator, it's been helpful for my trading.
I added in the moving averages that other MCDX variants on TradingView included.
Includes labels showing the percentage breakdown of the 3 groups and dynamic coloring.

Code:
# MultiColor DegenX Indicator
declare lower;
# Green/Cyan - Retailer / Locked
# Yellow/Gray - Hot money / Float
# Red/Pink - Banker / Profit
# Colors change if a group becomes weaker as it's value falls below the moving average

input banker_base = 50;
input banker_period = 50;
input hotmoney_base = 30;
input hotmoney_period = 40;
input banker_sens = 1.5;
input hotmoney_sens = 0.7;
input show_pct = yes;
input show_labels = yes;
input show_pma = yes;
input show_fma = no;
input show_lma = yes;

# Base value
def BASE = 20.0;

# RSI calculations
def banker_rsi = banker_sens * (RSI(price = close, length = banker_period).RSI - banker_base);
def banker_rsi_capped = if banker_rsi > 20 then 20 else if banker_rsi < 0 then 0 else banker_rsi;

def hotmoney_rsi = hotmoney_sens * (RSI(price = close, length = hotmoney_period).RSI - hotmoney_base);
def hotmoney_rsi_capped = if hotmoney_rsi > 20 then 20 else if hotmoney_rsi < 0 then 0 else hotmoney_rsi;

# Component Values
def pc_val = banker_rsi_capped;
def fc_val = hotmoney_rsi_capped;

# Moving Averages
def base_length = 10;
def sma_pc = ExpAverage(pc_val, base_length);
def sma_fc = ExpAverage(fc_val - pc_val, base_length);
def sma_lc = ExpAverage(BASE - fc_val, base_length);

# Percentages
def profit_pct = Round((pc_val / BASE) * 100, 1);
def float_pct = Round(((fc_val - pc_val) / BASE) * 100, 1);
def locked_pct = Round(((BASE - fc_val) / BASE) * 100, 1);

# Component state definitions
def profit_state = pc_val >= sma_pc;
def float_state = (fc_val - pc_val) >= sma_fc;
def locked_state = (BASE - fc_val) >= sma_lc;

# Trading conditions
def banker_building = pc_val > 0 and pc_val > sma_pc and pc_val[1] == 0 and close > open;
def bank_pump = sma_pc > 0 and pc_val > sma_pc and close > open;
def banker_distribution = pc_val < sma_pc and pc_val[1] > pc_val;
def retail_trap = pc_val == 0 and close < open;

# Reference Lines
plot RefLine5 = 5;
plot RefLine10 = 10;
plot RefLine15 = 15;

RefLine5.SetDefaultColor(Color.DARK_GRAY);
RefLine10.SetDefaultColor(Color.DARK_GRAY);
RefLine15.SetDefaultColor(Color.DARK_GRAY);

RefLine5.SetStyle(Curve.SHORT_DASH);
RefLine10.SetStyle(Curve.SHORT_DASH);
RefLine15.SetStyle(Curve.SHORT_DASH);

# Moving Average Lines
plot MA_Profit = if show_pma then sma_pc else Double.NaN;
plot MA_Float = if show_fma then sma_fc else Double.NaN;
plot MA_Locked = if show_lma then sma_lc else Double.NaN;

MA_Profit.SetDefaultColor(Color.BLUE);
MA_Float.SetDefaultColor(Color.GRAY);
MA_Locked.SetDefaultColor(Color.MAGENTA);
MA_Profit.SetLineWeight(2);
MA_Float.SetLineWeight(2);
MA_Locked.SetLineWeight(2);

# Labels
AddLabel(show_pct,
    "Locked: " + locked_pct + "%",
    if locked_state then Color.CYAN else Color.GREEN
);
AddLabel(show_pct,
    "Float: " + float_pct + "%",
    if float_state then Color.YELLOW else CreateColor(128, 128, 0)
);
AddLabel(show_pct,
    "Profit: " + profit_pct + "%",
    if profit_state then Color.RED else Color.LIGHT_RED
);

# Condition Labels
AddLabel(show_labels and banker_building, "ACCUM", Color.CYAN);
AddLabel(show_labels and bank_pump, "PUMP", Color.YELLOW);
AddLabel(show_labels and banker_distribution, "DIST", Color.RED);
AddLabel(show_labels and retail_trap, "TRAP", Color.MAGENTA);

############################################################
# Plotting and Fill Section
############################################################

# Main value plots with Area style
def is_future_bar = isNaN(close);
plot ProfitLine = if is_future_bar then Double.NaN else pc_val;
plot FloatLine = if is_future_bar then Double.NaN else fc_val;
plot BaseLine = if is_future_bar then Double.NaN else BASE;
plot ZeroLine = 0;

# Color definitions
DefineGlobalColor("StrongProfit", Color.RED);
DefineGlobalColor("WeakProfit", CreateColor(255, 192, 192));
DefineGlobalColor("StrongFloat", Color.LIGHT_GRAY);
DefineGlobalColor("WeakFloat", Color.YELLOW);
DefineGlobalColor("StrongLocked", Color.CYAN);
DefineGlobalColor("WeakLocked", Color.LIGHT_GREEN);

# Set Area style for main plots
ProfitLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
FloatLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
BaseLine.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

ProfitLine.SetLineWeight(3);
FloatLine.SetLineWeight(3);
BaseLine.SetLineWeight(3);

# Line colors for main plots based on states
ProfitLine.AssignValueColor(if profit_state then GlobalColor("StrongProfit") else GlobalColor("WeakProfit"));
FloatLine.AssignValueColor(if float_state then GlobalColor("StrongFloat") else GlobalColor("WeakFloat"));
BaseLine.AssignValueColor(if locked_state then GlobalColor("StrongLocked") else GlobalColor("WeakLocked"));
View attachment 24170
Thank you very much for your help, I really appreciate it @741.
 
  • Like
Reactions: 741

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
354 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