Loken (v4) Bullish Smart Money for ThinkOrSwim

samer800

Moderator - Expert
VIP
Lifetime

check above video to know how to use the indicator.

CODE:

CSS:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare lower;
declare zerobase;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = isNaN(Close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if isNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = rsi_HotMoney;
def bank = rsi_Banker;
def hotMoney = hot;#, "Hot Money"

def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);

def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);

def hotline = hotma; # "Hot Money MA"
def bankline = bankma;# "Banker MA"
def hotline2 = hotsignal;# "Hot Money MA2"
def bankline2 = banksignal; # "Banker MA2"
#//
AddCloud(hotline , hotline2, Color.DARK_GREEN, Color.DARK_RED);
AddCloud(bankline, bankline2, Color.VIOLET, Color.DARK_ORANGE);
AddCloud(hot, hotline, Color.GREEN, Color.RED);

#//
def hbAvg = ((hot*10)+(hotma*35)+(hotsignal*15)+(bankma*35)+(banksignal* 5))/ 100;
def hbma = vwma(hbAvg, 2);

plot HBMA2 = hbma; # "Trend Tracker"
HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);
plot h1 = if last then na else threshold;#, "Bullish Confirmation Line"
h1.SetDefaultColor(Color.GRAY);
h1.SetStyle(Curve.SHORT_DASH);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);
  

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetStyle(Curve.POINTS);
upSig.SetStyle(Curve.POINTS);
dnSig.SetDefaultColor(Color.RED);
upSig.SetDefaultColor(Color.GREEN);

def dnCond = Bank<Bank[1] and Bank<Bank[2] and Bank[1]<Bank[2] and Bank<Bank[3] and Bank<Bank[4] and Bank[3]<Bank[4] and Bank[6]>8.5 and Bank<10;

plot Dump = if Bank<Bank[1]/1.75 then Bank else na;#, "Dump Candles"
plot DnCandle = if dnCond then Bank else na;#, "Down Candles"
plot PumpCandle = if Bank>hbma then Bank else na;# "Pump Candles"
plot Retest = if banksignal>bankma and Bank>0 then Bank else na; # "Retest Candles"

Dump.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
Retest.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PumpCandle.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
DnCandle.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Dump.SetDefaultColor(Color.RED);
Retest.SetDefaultColor(Color.DARK_RED);
PumpCandle.SetDefaultColor(Color.GREEN);
DnCandle.SetDefaultColor(Color.DARK_GRAY);

plot Banker = bank;#,   "Banker"
Banker.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Banker.AssignValueColor(if bank > 0 then GlobalColor("nor") else Color.DARK_GRAY);



#-- END of CODE
 
I like this one! I like those dots so I thought I would create a UPPER indicator that includes the dots. Changed the color of them...

Code:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare upper;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = IsNaN(close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if IsNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = rsi_HotMoney;
def bank = rsi_Banker;
def hotMoney = hot;#, "Hot Money"
def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);
def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);

#//
def hbAvg = ((hot * 10) + (hotma * 35) + (hotsignal * 15) + (bankma * 35) + (banksignal * 5)) / 100;
def hbma = vwma(hbAvg, 2);

def HBMA2 = hbma; # "Trend Tracker"
#HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
upSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
dnSig.SetDefaultColor(Color.magenta);
upSig.SetDefaultColor(Color.cyan);
upSig.SetLineWeight(5);
dnSig.SetLineWeight(5);
 
I like this one! I like those dots so I thought I would create a UPPER indicator that includes the dots. Changed the color of them...

Code:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare upper;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = IsNaN(close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if IsNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = rsi_HotMoney;
def bank = rsi_Banker;
def hotMoney = hot;#, "Hot Money"
def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);
def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);

#//
def hbAvg = ((hot * 10) + (hotma * 35) + (hotsignal * 15) + (bankma * 35) + (banksignal * 5)) / 100;
def hbma = vwma(hbAvg, 2);

def HBMA2 = hbma; # "Trend Tracker"
#HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
upSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
dnSig.SetDefaultColor(Color.magenta);
upSig.SetDefaultColor(Color.cyan);
upSig.SetLineWeight(5);
dnSig.SetLineWeight(5);
very nice @chewie76 , can you add the red and green part of the indicator, just like you did with the dot? i noticed the green and red area are very good. just the same way you added the dot.thank you in advance
 
very nice @chewie76 , can you add the red and green part of the indicator, just like you did with the dot? i noticed the green and red area are very good. just the same way you added the dot.thank you in advance
I think this is close. Not exactly right, but close.
Code:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare upper;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = IsNaN(close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if IsNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = close;
#def hot1  = rsi_HotMoney;
def bank = close;
#def bank1 = rsi_Banker;
def hotMoney = hot;#, "Hot Money"
def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);
def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def hotma1  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);
def hotline = hotma; # "Hot Money MA"
def bankline = bankma;# "Banker MA"
def hotline2 = hotsignal;# "Hot Money MA2"
def bankline2 = banksignal; # "Banker MA2"
plot line0 = hot;
plot line1 = hotline;
line0.assignvalueColor(if hotline > hotline2 then color.green else color.red);
line1.assignvalueColor(if hotline > hotline2 then color.green else color.red);
#//
AddCloud(hotline,   hotline2,   Color.DARK_GREEN,   Color.DARK_RED);
#AddCloud(bankline, bankline2, Color.VIOLET, Color.DARK_ORANGE);
AddCloud(hot, hotline, Color.GREEN, Color.RED);

#//
def hbAvg = ((hot * 10) + (hotma * 35) + (hotsignal * 15) + (bankma * 35) + (banksignal * 5)) / 100;
def hbma = vwma(hbAvg, 2);

def HBMA2 = hbma; # "Trend Tracker"
#HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
upSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
dnSig.SetDefaultColor(Color.magenta);
upSig.SetDefaultColor(Color.cyan);
upSig.SetLineWeight(5);
dnSig.SetLineWeight(5);
 
I think this is close. Not exactly right, but close.
Code:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare upper;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = IsNaN(close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if IsNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = close;
#def hot1  = rsi_HotMoney;
def bank = close;
#def bank1 = rsi_Banker;
def hotMoney = hot;#, "Hot Money"
def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);
def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def hotma1  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);
def hotline = hotma; # "Hot Money MA"
def bankline = bankma;# "Banker MA"
def hotline2 = hotsignal;# "Hot Money MA2"
def bankline2 = banksignal; # "Banker MA2"
plot line0 = hot;
plot line1 = hotline;
line0.assignvalueColor(if hotline > hotline2 then color.green else color.red);
line1.assignvalueColor(if hotline > hotline2 then color.green else color.red);
#//
AddCloud(hotline,   hotline2,   Color.DARK_GREEN,   Color.DARK_RED);
#AddCloud(bankline, bankline2, Color.VIOLET, Color.DARK_ORANGE);
AddCloud(hot, hotline, Color.GREEN, Color.RED);

#//
def hbAvg = ((hot * 10) + (hotma * 35) + (hotsignal * 15) + (bankma * 35) + (banksignal * 5)) / 100;
def hbma = vwma(hbAvg, 2);

def HBMA2 = hbma; # "Trend Tracker"
#HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
upSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
dnSig.SetDefaultColor(Color.magenta);
upSig.SetDefaultColor(Color.cyan);
upSig.SetLineWeight(5);
dnSig.SetLineWeight(5);
@chewie76 thank you some much! let me bother you for one more thing, i really like this trading system, can you add a price color, for example when the bottom Red and Green indicator, if is turn it green paint the color green and if is short pain the candles red, just using the cloud red and green indicator. thank yo very much.
 
@chewie76 thank you some much! let me bother you for one more thing, i really like this trading system, can you add a price color, for example when the bottom Red and Green indicator, if is turn it green paint the color green and if is short pain the candles red, just using the cloud red and green indicator. thank yo very much.
Add this code to the bottom of the Lower indicator.
Code:
input Barcolor = yes;
AssignPriceColor(if Barcolor and hotline > hotline2 then color.green else color.red);
 
Add this code to the bottom of the Lower indicator.
Code:
input Barcolor = yes;
AssignPriceColor(if Barcolor and hotline > hotline2 then color.green else color.red);
I changed your hint for my use since I am not to stay in colored bars all the time and when setting to "no" it colored everything with red:


input PaintBar = no;
AssignPriceColor(if PaintBar and hotline > hotline2 then color.green else if PaintBar and hotline < hotline2 then color.red else color.CURRENT);
 
Is this suitable for intraday trading such as the 5 minute or 15, it is it only relevant for higher like daily?
 
Is this suitable for intraday trading such as the 5 minute or 15, it is it only relevant for higher like daily?
I originally created it for the 15m, it's better used for intraday imo
The concept of "Banker" is more relevant the higher the time-frame since it's only likely to be big buyer, if you use it on a lower time-frame just don't expect any bar to mean institutional activity, but the indicator could be used on seconds time-frames
 
I like this one! I like those dots so I thought I would create a UPPER indicator that includes the dots. Changed the color of them...

Code:
# https://www.tradingview.com/v/DlWtErRh/
#// © LOKEN94
#// Custom version based of [M2J] Indicator | MCDX
#study("LOKEN ? (v4) BULLISH MCDX v2.2", "?",precision=2)
# Converted by Sam4Cok@Samer800    - 09/2023
declare upper;

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"
input threshold = 8.5;

def na = Double.NaN;
def last = IsNaN(close);
DefineGlobalColor("nor", CreateColor(132, 175, 201));
#vwma(source, length)
script VWMA {
    input src = close;
    input len = 15;
    def v_ = volume;
    def v = if IsNaN(v_) then 1 else v_;
    def srcV = src * v;
    def VWMA = Average(srcV, len) / Average(v, len);
    plot result = VWMA;
}
#rsi_function(sensitivity, rsiPeriod, rsiBase) =>
script rsi_function {
    input sensitivity = 1;
    input rsiPeriod = 50;
    input rsiBase = 1;
    def nRSI = RSI(Price = close, Length = rsiPeriod);
    def rsi_ = sensitivity * (nRSI - rsiBase);
    def rsi = if rsi_ > 20 then 20 else
              if rsi_ < 0 then 0 else rsi_;
    plot out = rsi;
}

def rsi_Banker   = rsi_function(SensitivityBanker,   RSIPeriodBanker,   RSIBaseBanker);
def rsi_HotMoney = rsi_function(SensitivityHotMoney, RSIPeriodHotMoney, RSIBaseHotMoney);
def hot  = rsi_HotMoney;
def bank = rsi_Banker;
def hotMoney = hot;#, "Hot Money"
def hotma2   = WildersAverage(hot, 2);
def bankma2  = Average(bank, 2);
def hotma7   = WildersAverage(hot, 7);
def bankma7  = ExpAverage(bank, 7);
def hotma31  = WildersAverage(hot, 31);
def bankma31 = ExpAverage(bank, 31);
def hotma  = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def bankma = Average(((bankma2 * 70) + (bankma7 * 20) + (bankma31 * 10)) / 100, 2);
def hotsignal  = WildersAverage(hotma, 2);
def banksignal = WildersAverage(bankma, 4);

#//
def hbAvg = ((hot * 10) + (hotma * 35) + (hotsignal * 15) + (bankma * 35) + (banksignal * 5)) / 100;
def hbma = vwma(hbAvg, 2);

def HBMA2 = hbma; # "Trend Tracker"
#HBMA2.AssignValueColor(if hbma > threshold then Color.CYAN else Color.MAGENTA);

#//Crossing signals

def downtrendsignal = Crosses(hotma, hotsignal, CrossingDirection.BELOW);
def uptrendsignal = Crosses(hotma, hotsignal, CrossingDirection.ABOVE);

plot dnSig = if downtrendsignal then hbma else na;# "Downtrend signal"
plot upSig = if uptrendsignal  then hbma else na; # "Uprend signal"
dnSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
upSig.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
dnSig.SetDefaultColor(Color.magenta);
upSig.SetDefaultColor(Color.cyan);
upSig.SetLineWeight(5);
dnSig.SetLineWeight(5);
@chewie76 - is there a way to scan for the green dots? I tried using both the originally posted indicator and your upper looking for "upsig" but both times it gives me a thinkorswim error. If this is too complex I wonderif there is at least a surrogate that could be used? thanks
 
@chewie76 - is there a way to scan for the green dots? I tried using both the originally posted indicator and your upper looking for "upsig" but both times it gives me a thinkorswim error. If this is too complex I wonderif there is at least a surrogate that could be used? thanks
I get the same error. Not sure.
 
try this for scan http://tos.mx/hJTSU0Y (code below)
plot it first as an indicator for you to check if you find working
condition for scan => above 0 is for bullish and below 0 for bearish

I tried to clean what was not relevant to the scan and even then it gave error, then, since the code was as clean as it was possible, I cleaned the initial comments and it worked. my conclusion is that some character sequence in the comments, which are supposed to be neutral to the compiler were not so neutral and caused the mess. didn't go further to leave something for our hackers to discover. just left the credits

Code:
# @LOKEN94
# Converted by Sam4Cok@Samer800 - 09-2023

declare lower;
input RSIBaseHotMoney = 30;#, "Hot Money RSI Base"
input RSIPeriodHotMoney = 40;#, "Hot Money RSI Period"
input SensitivityHotMoney = 0.7;#, "Sensitivity Hot Money"


def nRSI = RSI(Price = close, Length = RSIPeriodHotMoney);
def rsi_ = SensitivityHotMoney * (nRSI - RSIBaseHotMoney);
def hot = if rsi_ > 20 then 20 else if rsi_ < 0 then 0 else rsi_;

def hotma2 = WildersAverage(hot, 2);
def hotma7 = WildersAverage(hot, 7);
def hotma31 = WildersAverage(hot, 31);

def hotma = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def hotsignal = WildersAverage(hotma, 2);


plot sig_updn = if (hotma < hotsignal and hotma[1]>hotsignal[1]) then -1 else if (hotma > hotsignal and hotma[1] < hotsignal[1]) then 1 else 0;
 
Last edited by a moderator:
try this for scan http://tos.mx/hJTSU0Y (code below)
plot it first as an indicator for you to check if you find working
condition for scan => above 0 is for bullish and below 0 for bearish

I tried to clean what was not relevant to the scan and even then it gave error, then, since the code was as clean as it was possible, I cleaned the initial comments and it worked. my conclusion is that some character sequence in the comments, which are supposed to be neutral to the compiler were not so neutral and caused the mess. didn't go further to leave something for our hackers to discover. just left the credits

# @LOKEN94
# Converted by Sam4Cok@Samer800 - 09-2023

declare lower;
input RSIBaseHotMoney = 30;#, "Hot Money RSI Base"
input RSIPeriodHotMoney = 40;#, "Hot Money RSI Period"
input SensitivityHotMoney = 0.7;#, "Sensitivity Hot Money"


def nRSI = RSI(Price = close, Length = RSIPeriodHotMoney);
def rsi_ = SensitivityHotMoney * (nRSI - RSIBaseHotMoney);
def hot = if rsi_ > 20 then 20 else if rsi_ < 0 then 0 else rsi_;

def hotma2 = WildersAverage(hot, 2);
def hotma7 = WildersAverage(hot, 7);
def hotma31 = WildersAverage(hot, 31);

def hotma = ExpAverage(((hotma2 * 34) + (hotma7 * 33) + (hotma31 * 33)) / 100, 2);
def hotsignal = WildersAverage(hotma, 2);


plot sig_updn = if (hotma < hotsignal and hotma[1]>hotsignal[1]) then -1 else if (hotma > hotsignal and hotma[1] < hotsignal[1]) then 1 else 0;
Is it possible to scan for the PUMPCANDLE only? I am really liking this one
 
I didn't test it. check it out.

CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at
#// © LOKEN94
#//  I made this indicator as a tribute to the late David Paul.
#//  He mentioned quite a lot about 89 periods moving average, also the 21 and 55.
#indicator("Tribute to David Paul",shorttitle="MA",overlay=tr)
# converted by Sam4Cok@Samer800 - 09/2023
input IR =2;#,minval=-1,maxval=2,tooltip="If -1, no entries zone will be displayed.    
input SDZ = yes;#,title="Show Supply & Demand zone",tooltip="Previous setting need to be set on 2.")
input MA = 4;#,minval=-1,maxval=5,title="Show ma",tooltip="If -1, no MA will be displayed.      
input enableTrendColors = no;

def na = Double.NaN;
DefineGlobalColor("up", CreateColor(33,150,243));
DefineGlobalColor("dn", CreateColor(179, 52, 52));#CreateColor(255,82,82));
DefineGlobalColor("dup", CreateColor(19, 92, 151));
DefineGlobalColor("ddn", Color.DARK_RED);#CreateColor(155, 28, 28));
def ma21 = Average(close, 21);
def ma55 = Average(close, 55);
def ma89 = Average(close, 89);


def BULL = ma21 <= close and ma55 <= close and ma89 <= close;
def BEAR = ma21 > close and ma55 > close and ma89 > close;

#float lowest_ma=ma89
def lowest_ma = if ma21 <= ma55 and ma21 <= ma89 then ma21 else
                if ma55 <= ma21 and ma55 <= ma89 then ma55 else ma89;
def highest_ma = if ma21 >= ma55 and ma21 >= ma89 then ma21 else
                 if ma55 >= ma21 and ma55 >= ma89 then ma55 else ma89;
#float IDEAL_LONG_ENTRY=na
def IDEAL_LONG_ENTRY = if BULL and !BULL[1] then low else IDEAL_LONG_ENTRY[1];
#float IDEAL_SHORT_ENTRY=na
def IDEAL_SHORT_ENTRY = if BEAR and !BEAR[1] then high else IDEAL_SHORT_ENTRY[1];
#float REAL_LONG_ENTRY=na
def REAL_LONG_ENTRY = if BULL and !BULL[1] then highest_ma else REAL_LONG_ENTRY[1];
#float REAL_SHORT_ENTRY=na
def REAL_SHORT_ENTRY = if BEAR and !BEAR[1] then lowest_ma else REAL_SHORT_ENTRY[1];

#--
def iLP = if IDEAL_LONG_ENTRY!=IDEAL_LONG_ENTRY[1] then na else Average(IDEAL_LONG_ENTRY, 1);
def iSP = if IDEAL_SHORT_ENTRY!=IDEAL_SHORT_ENTRY[1] then na else Average(IDEAL_SHORT_ENTRY, 1);
def rLP = if REAL_LONG_ENTRY!=REAL_LONG_ENTRY[1] then na else Average(REAL_LONG_ENTRY, 1);
def rSP = if REAL_SHORT_ENTRY!=REAL_SHORT_ENTRY[1] then na else Average(REAL_SHORT_ENTRY, 1);

def ilong  = if BULL then iLP else na;#ilong[1];
def ishort = if BEAR then iSP else na;#ishort[1];
def rlong  = if BULL then rLP else na;#rlong[1];
def rshort = if BEAR then rSP else na;#rshort[1];

plot botdemand = if IR==1 or IR==2 then ilong else na;#,"Ideal Long entry"
plot topsupply = if IR==1 or IR==2 then ishort else na;#,"Ideal Short entry"
plot topdemand = if IR==0 or IR==2 then rlong else na;#,"Real Long entry"
plot botsupply = if IR==0 or IR==2 then rshort else na;#,"Real Short entry"
botdemand.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
topsupply.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
topdemand.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
botsupply.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

botdemand.SetDefaultColor(GlobalColor("up"));
topsupply.SetDefaultColor(GlobalColor("dn"));
topdemand.SetDefaultColor(GlobalColor("up"));
botsupply.SetDefaultColor(GlobalColor("dn"));

AddCloud(if !SDZ then na else topdemand,botdemand, GlobalColor("up"), GlobalColor("up"));
AddCloud(if !SDZ then na else topsupply,botsupply,GlobalColor("dn"), GlobalColor("dn"));

#//
def ama = (ma21 + ma55 + ma89) / 3;

def AC = if close > ama then 1 else
         if close < ama then -1 else AC[1];
#//
def FLAT = if AC==1 and AC[1]!=1 then ama else
           if AC==-1 and AC[1]!=-1 then ama else FLAT[1];
#//
#float entries=rlong+rshort
def entries = if IR then ilong + ishort else rlong+rshort;
#//
def flat1_ = Average(FLAT,1);
def FLAT1  = if flat1_!=flat1_[1] then na else flat1_;

def col= if ama<=close then (if ilong==iLP then 2 else 1) else
                            (if ishort==iSP then -2 else -1);

plot amaLine = if MA==1 or MA==4 or MA==5 then ama else  na;#,"AMA",color=ama<=close?color.rgb(0, 25, 45):color.rgb(10, 0, 0))
amaLine.AssignValueColor(if ama<=close then Color.CYAN else Color.MAGENTA);

def FA = FLAT1;# ,color=ama<=close?color.blue:color.red,style=plot.style_linebr,display=display.none,editable=false)


def FHL = hl2;#,display=display.none,editable=false)

AddCloud(if col==2 then FA else na,FHL, GlobalColor("up"), GlobalColor("up"));
AddCloud(if col==1 then FA else na,FHL, GlobalColor("dup"), GlobalColor("dup"));
AddCloud(if col==-2 then FA else na,FHL, GlobalColor("dn"), GlobalColor("dn"));
AddCloud(if col==-1 then FA else na,FHL, GlobalColor("ddn"), GlobalColor("ddn"));

#//
plot sma21 = if MA==0 or MA==4 then ma21 else na;
sma21.AssignValueColor(if ma21<=close then GlobalColor("up") else GlobalColor("dn"));

plot sma55 = if MA==0 or MA==4 or MA==5 then ma55 else na;
sma55.AssignValueColor(if ma55<=close then GlobalColor("up") else GlobalColor("dn"));

plot sma89 = if MA==0 or MA==4 then ma89 else na;
sma89.AssignValueColor(if ma89<=close then GlobalColor("up") else GlobalColor("dn"));

plot hiMa = if (MA==3 and (BULL==1 or ama<=close)) or (MA==2 and (BEAR==1 or ama>=close)) then highest_ma else na;
hiMa.AssignValueColor(if highest_ma<=close then GlobalColor("up") else GlobalColor("dn"));

plot loMa = if (MA==3 and (BEAR==1 or ama>=close)) or (MA==2 and (BULL==1 or ama<=close)) then lowest_ma else na;
loMa.AssignValueColor(if lowest_ma<=close then GlobalColor("up") else GlobalColor("dn"));

#-- Bar Color
def barCol = if ilong==iLP then 1 else
             if ishort==iSP then -1 else
             if !BULL and !BEAR then 0 else barCol[1];

AssignPriceColor(if !enableTrendColors then Color.CURRENT else
                 if barCol > 0 then Color.CYAN else
                 if barCol < 0 then Color.MAGENTA else Color.GRAY);


# -- END of CODE
@samer800 , is there a way to avoid this apparent graphic distortion as you can see in the picture ?
1697667758944.png
 

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