# need help finishing a code on trending stock scan

#### JJJJJJ11111

##### Member
Hi , anyone can help me finish the code on the watchlist column.

So i'm assuming if a stock intraday high is 4% higher than open, it's likely to trend up higher.
and if stock low is 4% lower than open it's likely to trend lower.

How i make a scan on my watch list to

Code:
``````input threshold = 4;

def trendup  = ((high - open)/open)*100 ;
def trenddn = ((open-low)/low)*100 ;``````

wants to do something like the column
produce 3 scenarios of
1. trend up if trendup > threshold
2. trend down if trenddn>threshold
3. NA if stock did not meet threshold, meaning the price is within 4% move.

thank u

Solution
Hi , anyone can help me finish the code on the watchlist column.

So i'm assuming if a stock intraday high is 4% higher than open, it's likely to trend up higher.
and if stock low is 4% lower than open it's likely to trend lower.

How i make a scan on my watch list to

Code:
``````input threshold = 4;

def trendup  = ((high - open)/open)*100 ;
def trenddn = ((open-low)/low)*100 ;``````

wants to do something like the column
produce 3 scenarios of
1. trend up if trendup > threshold
2. trend down if trenddn>threshold
3. NA if stock did not meet threshold, meaning the price is within 4% move.

thank u

...make a scan on my watchlist...

don't know if you want a scan or column code.
you mentioned scan first...

#### halcyonguy

##### Well-known member
VIP
Hi , anyone can help me finish the code on the watchlist column.

So i'm assuming if a stock intraday high is 4% higher than open, it's likely to trend up higher.
and if stock low is 4% lower than open it's likely to trend lower.

How i make a scan on my watch list to

Code:
``````input threshold = 4;

def trendup  = ((high - open)/open)*100 ;
def trenddn = ((open-low)/low)*100 ;``````

wants to do something like the column
produce 3 scenarios of
1. trend up if trendup > threshold
2. trend down if trenddn>threshold
3. NA if stock did not meet threshold, meaning the price is within 4% move.

thank u

...make a scan on my watchlist...

don't know if you want a scan or column code.
you mentioned scan first, so i'm guessing scan...

Code:
``````plot z = if ( trendup > threshold or
absvalue(trenddn) > threshold) then 1 else 0;``````

thank u

#### JJJJJJ11111

##### Member
I'm working in to use in a watchlist column

The idea is to buy this kind of dip after or short the pop after a mass panic .

I have added in \$3 move run as an assumption of a trend for stock price between \$60 to \$422725

I want only results that are at the vwap right now, i assume it's 0.8% for stock price below \$60.
and \$0.3 for stock price above \$60.

Keep getting no result.

Code:
``````#trend signal
input perc_threshold = 4;
input dollar_threshold = 3 ;

def trendup  = ((high - open)/open)*100 ;
def trenddn = ((open-low)/low)*100 ;
def dollartrendup = (high-open);
def dollartrenddn = (open-low);

#vwap distance
input vwap_percent = 0.8;
input vwap_dollar = 0.3;
input price   = close;
def   VWAP    = reference VWAP();

plot z = if ( trendup > perc_threshold and between(price, VWAP - 1 * (vwap_percent/100), VWAP + 1 * (vwap_percent/100))
or

absvalue(trenddn) > perc_threshold) and between(price, VWAP - 1 * (vwap_percent/100), VWAP + 1 * (vwap_percent/100))

or

close >60 and dollartrendup>dollar_threshold and between(price, vwap_dollar, VWAP + vwap_dollar)

or
close < 60 and absvalue(dollartrenddn) > dollar_threshold and  between(price, vwap_dollar, VWAP + vwap_dollar)

then 1 else 0;
;``````

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
• 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?