Leledc Exhaustion Indicator for ThinkorSwim

Here you go:

I use Major of 10/40 for the 30 minute.

screenshot with defaults 6/30


Code:
#Leledc Exhaustion Port
#Joy_Bangla
#
#https://www.tradingview.com/script/pQv1kge2-Leledc-Exhaustion-V4/
#The Psychology
#Let's assume that we have a group of people, say 100 people who decide to go for a casual running.
#After running for a few KM's few of them will say “I am exhausted. I cannot run further”.
#They will quit running. After running further, another bunch of runners will say I am exhausted. I can’t run further
#and they also will quit running. This goes on and on and then there will be a stage where only a few will be left
#in the running. Now a stage will come where the last person left in the running will say am exhausted and he stops running.
#That means no one is left now in the running. This means all are exhausted in the running.
#
#The same way an exhaustion bar works. The reason is an exhaustion bar sometimes formed at almost tops and bottoms.
#
#Timeframe
#The exhaustion bars are found on all Time frames as a trend also exists on all Timeframes.
#However, as a thumb rule Higher the Time frame, higher will be the accuracy as well as the profitability.
#
#Trading the Leledec Exhaustion Bars
#I may trade as soon as it is shown on the chart.
#I may trade when price breaks the high/low of the bar depending on whether I am getting bullish or bearish signal
#I may trade when price breaks the high/low of the bar depending on whether I am getting bullish or bearish signal.
#I may also be looking to ensure the current volume is higher than the previous few
#(? how many?) bar volumes.
#
# Ported 2019.11.16
# Release 1.0
#

input maj_qual = 6;
input maj_len = 30;
input min_qual = 5;
input min_len = 5;

input showMajor = yes; #show major
input showMinor = no; #show minor

script lele {
    input qual = 6; #default major
    input len = 30; #default major

    def bIndex = CompoundValue(1,
     if (bIndex[1] > qual) and (close < open) and high >= Highest(high, len) then 0 else
     if (close > close[4]) then bIndex[1] + 1 else bIndex[1]
    , 0);

    def sIndex = CompoundValue(1,
     if ((sIndex[1] > qual) and (close > open) and (low <= Lowest(low, len))) then 0 else
     if (close < close[4]) then sIndex[1] + 1 else sIndex[1]
    , 0);

    def ret =
     if (bIndex[1] > qual) and (close < open) and high >= Highest(high, len) then -1 else
     if ((sIndex[1] > qual) and (close > open) and (low <= Lowest(low, len))) then 1
    else 0;

    plot sData = ret;
}

#PLOTS

def major = lele(maj_qual,maj_len);
def minor = lele(min_qual,min_len);


plot pUP = major == 1;
pUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pUP.SetDefaultColor(Color.GREEN);
pUP.SetLineWeight(2);

plot pDown = major == -1;
pDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pDown.SetDefaultColor(Color.RED);
pDown.SetLineWeight(2);

plot pMinorUP = minor == 1 and showMinor;
pMinorUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pMinorUP.SetDefaultColor(Color.BLue);
pMinorUP.SetLineWeight(2);

plot pMinorDown = minor == -1 and showMinor ;
pMinorDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pMinorDown.SetDefaultColor(Color.yellow);
pMinorDown.SetLineWeight(2);


# Alerts
Alert(pUP, " ", Alert.Bar, Sound.Chimes);
Alert(pDown, " ", Alert.Bar, Sound.Bell);
 
Hi, can anyone explain what is the difference to use Maj or Minor and any recommended setting for Swing Trading on Daily timeframe? Thanks
 
Here's a complete Leledc script; enable or disable the following in any combination with inputs to quality and length
suggestion; lower the time frame; increase quality and length. opposite for higher time frames
  • Major Buyers; arrows, lines, clouds, alerts
  • Major Sellers; arrows, lines, clouds, alerts
I tried adding color inputs with getColor but the actual colors weren't lining up.

COST / 30 Min
  • Major Buyers cloud low To Mid with Corresponding lines
  • Minor Buyers cloud Mid to High with Corresponding lines
  • Major Sellers cloud Low to Mid with Corresponding lines
  • Minor Sellers disabled



AMZN / 10 Min
  • Major Buyers arrow and low line
  • Major Sellers arrow and high line
  • Minor buyers arrow, no lines, with low to mid clouds
  • Minor Sellers disabled


FB / Daily
  • Major Buyers; Low Line Only
  • Major Sellers; High Line only
  • Minor Buyers; disabled
  • Minor Sellers; Mid to High Cloud only

Code:
#Complete_Leledc
#Leledc Exhaustion Port
#https://usethinkscript.com/threads/leledc-exhaustion-indicator-for-thinkorswim.3369/page-3
#Original by @diazlaz



#hint maj_qual: Original setting is 6
#hint maj_len: Original setting is 30
#hint showMajorArrowsWeight: Min 1 Max 5
#hint showMajorLineWeight: Min 1 Max 5

input showMajor = yes;
input maj_qual = 6;
input maj_len = 30; #hint: Original setting is 30


input showMajorBuyers = yes;
input showMajorSellers = yes;

input showMajorArrows = yes;
input showMajorLines = yes;
input ShowMajorClouds = yes;


input MajorArrowsWeight = 2; #hint: Max is 5
input MajorLineWeight = 2; #hint: Max is 5

script lele {
    input qual = 100;  #note: does use input variable
    input len = 100;   #note: does use input variable

    def bIndex = CompoundValue(1,
     if (bIndex[1] > qual) and (close < open) and high >= Highest(high, len) then 0 else
     if (close > close[4]) then bIndex[1] + 1 else bIndex[1]
    , 0);

    def sIndex = CompoundValue(1,
     if ((sIndex[1] > qual) and (close > open) and (low <= Lowest(low, len))) then 0 else
     if (close < close[4]) then sIndex[1] + 1 else sIndex[1]
    , 0);

    def ret =
     if (bIndex[1] > qual) and (close < open) and high >= Highest(high, len) then -1 else
     if ((sIndex[1] > qual) and (close > open) and (low <= Lowest(low, len))) then 1
    else 0;

    plot sData = ret;
}


###############
# Major section
###############

def major = lele(maj_qual,maj_len);

def MajorBuyers = major == 1;
def MajorSellers = major == -1;


###############
# Major Arrows
###############


plot MajorBuyersArrow = if showMajor and showMajorBuyers and showMajorArrows and MajorBuyers then low else double.nan ;
MajorBuyersArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
MajorBuyersArrow.SetDefaultColor(color.light_green);
MajorBuyersArrow.SetLineWeight(MajorArrowsWeight);

plot MajorSellersArrow = if showMajor and showMajorBuyers and showMajorArrows and MajorSellers then high else double.nan;
MajorSellersArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Down);
MajorSellersArrow.SetDefaultColor(color.light_red);
MajorSellersArrow.SetLineWeight(MajorArrowsWeight);

###############
# Major Lines
###############


input showMajorBuyersLowLine = yes;
input showMajorBuyersMidLine = yes;
input showMajorBuyersHighLine = yes;

input showMajorSellersLowLine = yes;
input showMajorSellersMidLine = yes;
input showMajorSellersHighLine = yes;

def MajorBuyersLow = if MajorBuyers then (low) else MajorBuyersLow[1];
def MajorBuyersMid = if MajorBuyers then (high + low)/2 else MajorBuyersMid[1];
def MajorBuyersHigh = if MajorBuyers then (high) else MajorBuyersHigh[1];

def MajorSellersLow = if MajorSellers then (low) else MajorSellersLow[1];
def MajorSellersMid = if MajorSellers then (high + low)/2 else MajorSellersMid[1];
def MajorSellersHigh = if MajorSellers then (high) else MajorSellersHigh[1];


plot MajorBuyersLowLine = if showMajor and showMajorBuyers and showMajorLines and showMajorBuyersLowLine  then MajorBuyersLow else double.nan;
MajorBuyersLowLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorBuyersLowLine.SetDefaultColor(color.light_green);
MajorBuyersLowLine.SetLineWeight(MajorLineWeight);


plot MajorBuyersMidLine = if showMajor  and showMajorBuyers and showMajorLines and showMajorBuyersMidLine and MajorBuyersMid then MajorBuyersMid else double.nan;
MajorBuyersMidLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorBuyersMidLine.SetDefaultColor(color.light_green);
MajorBuyersMidLine.SetLineWeight(MajorLineWeight);


plot MajorBuyersHighLine = if showMajor and showMajorBuyers and showMajorLines and showMajorBuyersHighLine and MajorBuyersHigh then MajorBuyersHigh else double.nan;
MajorBuyersHighLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorBuyersHighLine.SetDefaultColor(color.light_green);
MajorBuyersHighLine.SetLineWeight(MajorLineWeight);


plot MajorSellersLowLine = if showMajor and showMajorSellers and showMajorLines and showMajorSellersLowLine and MajorSellersLow then MajorSellersLow else double.nan;
MajorSellersLowLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorSellersLowLine.SetDefaultColor(color.light_red);
MajorSellersLowLine.SetLineWeight(MajorLineWeight);


plot MajorSellersMidLine = if showMajor and showMajorSellers  and showMajorLines and showMajorSellersMidLine and MajorSellersMid then MajorSellersMid else double.nan;
MajorSellersMidLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorSellersMidLine.SetDefaultColor(color.light_red);
MajorSellersMidLine.SetLineWeight(MajorLineWeight);


plot MajorSellersHighLine = if showMajor and showMajorSellers  and showMajorLines and showMajorSellersHighLine and MajorSellersHigh then MajorSellersHigh else double.nan;
MajorSellersHighLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MajorSellersHighLine.SetDefaultColor(color.light_red);
MajorSellersHighLine.SetLineWeight(MajorLineWeight);


###############
# Major Clouds
###############

input showMajorBuyersLowToMidCloud = yes;
input showMajorBuyersMidToHighCloud = yes;
input showMajorSellersLowToMidCloud = yes;
input showMajorSellersMidToHighCloud = yes;

def MajorBuyersLowForCloud = if MajorBuyers then (low) else MajorBuyersLow[1];
def MajorBuyersMidForCloud = if MajorBuyers then (high + low)/2 else MajorBuyersmid[1];
def MajorBuyersHighforCloud = if MajorBuyers then (high) else MajorBuyersHigh[1];

def MajorSellersLowForCloud = if MajorSellers then (low) else MajorSellersLow[1];
def MajorSellersMidForCloud = if MajorSellers then (high + low)/2 else MajorSellersMid[1];
def MajorSellersHighForCloud = if MajorSellers then (high) else MajorSellersHigh[1];

addcloud(if showMajor and showMajorBuyers and showMajorClouds and showMajorBuyersLowToMidCloud  then  MajorBuyersLowForCloud else Double.nan, MajorBuyersMidForCloud,color.light_green,color.light_green);
addcloud(if showMajor and showMajorBuyers and showMajorClouds and showMajorBuyersMidToHighCloud then MajorBuyersMidForCloud else Double.nan, MajorBuyersHighforCloud,color.light_green,color.light_green);
addcloud(if showMajor and showMajorSellers and showMajorClouds and showMajorSellersLowToMidCloud then MajorSellersLowForCloud else Double.nan, MajorSellersMidForCloud,color.light_red,color.light_red);
addcloud(if showMajor and showMajorSellers and showMajorClouds and showMajorSellersMidToHighCloud  then MajorSellersMidForCloud else Double.nan, MajorSellersHighForCloud,color.light_red,color.light_red);


###############
# Minor section
###############


#hint min_qual: Original setting is 5
#hint min_len: Original setting is 5

input showMinor = yes;
input min_qual = 5; #hint: Original setting is 5
input min_len = 5; #hint: Original setting is 5
def minor = lele(min_qual,min_len);

def MinorBuyers = Minor == 1;
def MinorSellers = Minor == -1;

input ShowMinorBuyers = yes;
input ShowMinorSellers = yes;

input showMinorArrows = yes;
input showMinorLines = yes;
input ShowMinorClouds = yes;

input MinorArrowsWeight = 1;
input MinorLineWeight = 1;

###############
# Minor Arrows
###############

plot MinorBuyersArrow = if showMinor and !MajorBuyers and showMinorBuyers  and ShowMinorArrows and MinorBuyers then low else double.nan ;
MinorBuyersArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
MinorBuyersArrow.SetDefaultColor(color.cyan);
MinorBuyersArrow.SetLineWeight(MinorArrowsWeight);

plot MinorSellersArrow = if showMinor and !MajorSellers and showMinorSellers and ShowMinorArrows and MinorSellers then high else double.nan ;
MinorSellersArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Down);
MinorSellersArrow.SetDefaultColor(color.yellow);
MinorSellersArrow.SetLineWeight(MinorArrowsWeight);



###############
# Minor Lines
###############

input showMinorBuyersLowLine = yes;
input showMinorBuyersMidLine = yes;
input showMinorBuyersHighLine = yes;

input showMinorSellersLowLine = yes;
input showMinorSellersMidLine = yes;
input showMinorSellersHighLine = yes;

def MinorBuyersLow = if MinorBuyers and !MajorBuyers then (low) else MinorBuyersLow[1];
def MinorBuyersMid = if MinorBuyers and !MajorBuyers then (high + low)/2 else MinorBuyersMid[1];
def MinorBuyersHigh = if MinorBuyers and !MajorBuyers then (high) else MinorBuyersHigh[1];

def MinorSellersLow = if MinorSellers and !MajorSellers then (low) else MinorSellersLow[1];
def MinorSellersMid = if MinorSellers and !MajorSellers then (high + low)/2 else MinorSellersMid[1];
def MinorSellersHigh = if MinorSellers and !MajorSellers then (high) else MinorSellersHigh[1];


plot MinorBuyersLowLine = if showMinor and !MajorBuyers  and showMinorBuyers  and showMinorLines and showMinorBuyersLowLine and MinorBuyersLow then MinorBuyersLow else double.nan;
MinorBuyersLowLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorBuyersLowLine.SetDefaultColor(color.cyan);
MinorBuyersLowLine.SetLineWeight(MinorLineWeight);


plot MinorBuyersMidLine = if showMinor and !MajorBuyers and showMinorBuyers and showMinorLines and showMinorBuyersMidLine and MinorBuyersMid then MinorBuyersMid else double.nan;
MinorBuyersMidLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorBuyersMidLine.SetDefaultColor(color.cyan);
MinorBuyersMidLine.SetLineWeight(MinorLineWeight);


plot MinorBuyersHighLine = if showMinor and !MajorBuyers and showMinorBuyers   and showMinorLines and showMinorBuyersHighLine and MinorBuyersHigh then MinorBuyersHigh else double.nan;
MinorBuyersHighLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorBuyersHighLine.SetDefaultColor(color.cyan);
MinorBuyersHighLine.SetLineWeight(MinorLineWeight);


plot MinorSellersLowLine = if showMinor and !MajorSellers and showMinorSellers  and showMinorLines and showMinorSellersLowLine and MinorSellersLow then MinorSellersLow else double.nan;
MinorSellersLowLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorSellersLowLine.SetDefaultColor(color.yellow);
MinorSellersLowLine.SetLineWeight(MinorLineWeight);


plot MinorSellersMidLine = if showMinor and !MajorSellers and showMinorSellers  and showMinorLines and showMinorSellersMidLine and MinorSellersMid then MinorSellersMid else double.nan;
MinorSellersMidLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorSellersMidLine.SetDefaultColor(color.yellow);
MinorSellersMidLine.SetLineWeight(MinorLineWeight);


plot MinorSellersHighLine = if showMinor and !MajorSellers and showMinorSellers  and showMinorLines and showMinorSellersHighLine and MinorSellersHigh then MinorSellersHigh else double.nan;
MinorSellersHighLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MinorSellersHighLine.SetDefaultColor(color.yellow);
MinorSellersHighLine.SetLineWeight(MinorLineWeight);





###############
# Minor Clouds
###############


input showMinorBuyersMidToHighCloud = yes;
input showMinorBuyersLowToMidCloud = yes;
input showMinorSellersMidToHighCloud = yes;
input showMinorSellersLowToMidCloud = yes;

def MinorBuyersLowForCloud = if MinorBuyers and !MajorBuyers then (low) else MinorBuyersLow[1];
def MinorBuyersMidForCloud = if MinorBuyers and !MajorBuyers  then (high + low)/2 else MinorBuyersMid[1];
def MinorBuyersHighForCloud = if MinorBuyers and !MajorBuyers  then (high) else MinorBuyersHigh[1];

def MinorSellersLowForCloud = if MinorSellers  and !MajorSellers then (low) else MinorSellersLow[1];
def MinorSellersMidForCloud = if MinorSellers  and !MajorSellers then (high + low)/2 else MinorSellersMid[1];
def MinorSellersHighForCloud = if MinorSellers and !MajorSellers then (high) else MinorSellersHigh[1];


addcloud(if ShowMinor and ShowMinorBuyers and !MajorBuyers and showMinorClouds and showMinorBuyersLowToMidCloud  then MinorBuyersLowForCloud else Double.nan, MinorBuyersMidForCloud,color.cyan,color.cyan);
addcloud(if ShowMinor and ShowMinorBuyers and !MajorBuyers and showMinorClouds and showMinorBuyersMidToHighCloud  then MinorBuyersMidForCloud else Double.nan, MinorBuyersHighForCloud,color.cyan,color.cyan);

addcloud(if ShowMinor and ShowMinorSellers and !MajorSellers and showMinorClouds and showMinorSellersLowToMidCloud  then MinorSellersLowForCloud else Double.nan, MinorSellersMidForCloud,color.yellow,color.yellow);
addcloud(if ShowMinor and ShowMinorSellers and !MajorSellers and showMinorClouds and showMinorSellersMidToHighCloud then MinorSellersMidForCloud else Double.nan, MinorSellersHighForCloud,color.yellow,color.yellow);



###############
# ALERTS
###############
input UseAlerts = yes;
input AlertMajorSellers = yes;
input AlertMajorBuyers = yes;
input AlertMinorSellers = yes;
input AlertMinorBuyers = yes;

Alert(showMajor and UseAlerts and AlertMajorBuyers  and MajorBuyers, "Leledc Major Buyers", Alert.Bar, Sound.Chimes);
Alert(showMajor and UseAlerts and AlertMajorSellers and MajorSellers, "Leledc Major Sellers", Alert.Bar, Sound.Chimes);
Alert(showMinor and UseAlerts and AlertMinorBuyers and MinorSellers and !MajorBuyers, "Leledc Minor Buyers", Alert.Bar, Sound.Chimes);
Alert(showMinor and UseAlerts and AlertMinorSellers and MinorSellers and !MajorBuyers, "Leledc Minor Sellers", Alert.Bar, Sound.Chimes);

###############
# Bubbles
###############
Input showBubbles = yes;
input showMajorBubbles = yes;
input showMinorBubbles = yes;
addchartbubble(showBubbles and showMajorBubbles and MajorSellers,high ,"Major SELLERS",color.light_red,yes);
addchartbubble(showBubbles and showMajorBubbles and MajorBuyers,low ,"Major BUYERS",color.light_green,no);
addchartbubble(showBubbles and showMinorBubbles and MinorSellers and !MajorSellers,high ,"Minor SELLERS",color.cyan,yes);
addchartbubble(showBubbles and showMinorBubbles and MinorBuyers and !MajorBuyers,low ,"Minor BUYERS",color.yellow,no);
 
Last edited:
Thanks @Alex I updated the post with code to include bubbles - nothing is complete without some bubbles right.. also removed 'show' from the weight inputs

Here's TSLA 3 Min


my new 7k tick MNQ (note my colors use cyan for Major buyers)

@GoldStriple Thanks for sharing !! I love to trade TSLA and this indicator is really cool!!
For my learning looking at your TSLA chart, for potential trade entry, it is advisable to look for the Maj Seller or Buyers and avoid minor Seller n buyer?
Secondly, may I also know how do u determine which plot (major buyer or Major Seller or Minor Buyer etc) to enable or disable and get clean chart? Does it need to be align to any specific timeframe, eg daily chart to enable or disable certain plot?

This is what I have got when I uploaded the script...

looking forward to learn more..thank u


https%3A//i.imgur.com/A0pXzdp.jpg[/img]']
A0pXzdp.jpg
 
all about how you want to use it.. personally I like to use it as S/R - using prior or pre-market lines/clouds and then enter if price is resisted or bouncing off of. increasing length and quality will reduce signals may help - especially if you trade lower time frames... you can start there and see what you like then just play around with lines and/or clouds. All about taste and what you visually can trade to.

looking forward to seeing what you come with. happy trading.
 
Is it possible to have the plot & alert from a higher timeframe onto a lower one? For example, i would like to have the plot & alert from the 4min chart onto the 2min chart, can this be achieved? @BenTen
 
Is it possible to have the plot & alert from a higher timeframe onto a lower one? For example, i would like to have the plot & alert from the 4min chart onto the 2min chart, can this be achieved? @BenTen
No.
What you are asking is not possible.

Here is why:
This study utilizes a script function.
Statements referencing other timeframes do not work within script{} functions.
https://usethinkscript.com/threads/...zing-script-for-secondary-aggs.969/#post-7881

Therefore, this study cannot be turned into an MTF indicator to reference a higher timeframe onto a lower one.
 

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