# It tells you how much % 1 moving MDA line away from crossing another, and it colors it based on whether it's above or below.

#### Mr_Wheeler

##### Active member

"Ck 1st" is abbreviation for "Check first", "9 Abv 200" simply means that the 9 MDA is above 200.

Code:
``````# avgs_per_diff_00

declare lower;

input avg1Type = Averagetype.simple;
input avg2type = Averagetype.simple;
input Avg1Length = 9;
input Avg2Length = 50;

def avg1 = MovingAverage(avg1Type, close, avg1Length);
def avg2 = MovingAverage(avg2Type, close, avg2Length);
def avgup = (avg1 > avg2);

#def AvgPercent = MovingAverage(avg1Type, close, avg1Length)-MovingAverage(avg2Type, close, avg2Length);
# plot percentDiff = (absValue(avgPercent)/movingaverage(avg1type,close,avg1length)) *100;

def Avg12diff = avg1 - avg2;

plot percentDiff = (absValue(avg12diff)/avg1) *100;
percentDiff.DefineColor("Up", color.green);
percentDiff.DefineColor("Down", color.red);
percentDiff.AssignValueColor(if avgup then percentDiff.color("up") else percentDiff.color("down"));

AssignBackgroundColor(if Avg1 is greater than or equal to Avg2 then (CreateColor(0, 102, 0)) else Color.light_GRAY);

.``````

• I have my studies set up on the 15 minute chart without extended hours because because low volume throws everything out of wack such as VWAP.

• Green square on the "9 ABV 50" means that the 9 MDA line has crossed the 50 MDA line.

• If that square was white instead it would mean the 9 MDA is under the 50 MDA line.

• Currently it's it has the value of "2.37" within the green square. That means the 9 MDA is 02.37 % above the 50 MDA line.

• The RSI is separate. I have it there & color coded so I instantly know if I should avoid making the trade.

• If you take a 2nd look at my layout you'll see "9 MA", "50 MA", and "200 MA ". Those are the actual moving average values. I use weighted moving averages because that's enables me to get the best result when using a bunch of other studies.

• When I look for studies or indicators, I look for things to plug holes in the over all picture of a stock's movement. I created this scanner setup & scanner studies because I wanted to quickly glance at a scanner's output. I didn't like how I was slowly comparing the MDA values to each other for each stock was displayed, so I created the scanner study to "plug a hole".

I'm sorry, I should have explained my scanner set up.

Last edited by a moderator:

87k+ Posts
369 Online

## 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
• 1 full year of unlimited support

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?