# Need Help with Laguerre moving averge

#### J007RMC

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

#### J007RMC

##### Well-known member
2019 Donor
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

Code:
``````# 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;
}
else
{
bullStateCounter = bullStateCounter[1];
bearStateCounter = bearStateCounter[1];
}
addLabel(1, if bullStateCounter then "Buy Signal = " + bullStateCounter else “Sell Signal = " + bearStateCounter,
if bullStateCounter then color.green else color.red);

# 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, color.pink);

AssignPriceColor(if HAclose > HAopen then color.green else color.red);
# End Code``````

Last edited:

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• 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?