Need Help with Laguerre moving averge


Well-known member
2019 Donor
I'm wanting to have a Laguerre moving average x2. Meaning two Laguerre moving averages so I can change the base color and length independently for each. My ideal is to set one at 10 and the other at 30. For instance change to blue base in red the other change to green base into red and back.
Well I do have question too say Im watching my watchlist and Im seeing both bull and bear counting bars, for instance bull count 3 bear count 5 different stocks? I dont understand the theory behind the counts? Thanks

# HA Watchlist
# Paris
# 2.9.2019

# Paris: Vide Mobius comments that Mary's HA defs were wrong,
# changed the definitions for HAhigh, HAlow, and HAclose.
# Also added extra logic that resets counts for state transitions

def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, HAopen[1] + HAclose[1], open[1] + close[1])/2;
HAhigh = Max(high, Max(HAclose, HAopen));
HAlow = Min(low, Min(HAclose, HAopen));
haclose = OHLC4;
def noWickBullish = haClose > haOpen and haOpen == haLow;
def nowickBearish = haClose < haOpen and haOpen == haHigh;

def bullStateCounter;
def bearStateCounter;
if noWickBullish
     bullStateCounter = bullStateCounter[1] + 1;
     bearStateCounter = 0;
else if nowickBearish
     bullStateCounter = 0;
     bearStateCounter = bearStateCounter[1] + 1;
     bullStateCounter = bullStateCounter[1];
     bearStateCounter = bearStateCounter[1];
addLabel(1, if bullStateCounter then "Buy Signal = " + bullStateCounter else “Sell Signal = " + bearStateCounter,
            if bullStateCounter then else;

# Added logic that resets counts for state transitions

def BullCount = if bullStateCounter and bearStateCounter[1]
                then 1
                else if bullStateCounter >= 1
                     then BullCount[1] + 1
                else BullCount[1];
def BearCount = if bearStateCounter and bullStateCounter[1]
                then 1
                else if bearStateCounter >= 1
                     then BearCount[1] + 1
                else BearCount[1];
AddLabel(bullStateCounter, "Bull Count = " + BullCount, color.cyan);
AddLabel(bearStateCounter, "Bear Count = " + BearCount,;

AssignPriceColor(if HAclose > HAopen then else;
# End Code
Last edited:

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
229 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.