HighestAll scan

CharlieK

New member
I have a couple of labels on my chart. One is the Highest price, the second is the percentage off of the high. The labels work as intended. This is used on a Monthly/Max chart.

Labels:

input price = high;
def H = HighestAll(high);
def Per = ((HighestAll(high)-close)/HighestAll(high))*100;

AddLabel(1, "HighestAll = : + H, Color.CYAN);
AddLabel(1, "% Off High = : + Per, Color.CYAN);

I wanted to add this to a scan, to find names that are within 20% of the high. It's returning names that are well beyond 20... The aggregation in the Scanner Custom Filter is set to Mo.

def Per = ((HighestAll(high)-close)/HighestAll(high))*100;
def Tight = if Per <= 20 then 1 else 0;
plot signal = if Tight then 1 else 0;

What do I have wrong?
 
Solution
I have a couple of labels on my chart. One is the Highest price, the second is the percentage off of the high. The labels work as intended. This is used on a Monthly/Max chart.

Labels:

input price = high;
def H = HighestAll(high);
def Per = ((HighestAll(high)-close)/HighestAll(high))*100;

AddLabel(1, "HighestAll = : + H, Color.CYAN);
AddLabel(1, "% Off High = : + Per, Color.CYAN);

I wanted to add this to a scan, to find names that are within 20% of the high. It's returning names that are well beyond 20... The aggregation in the Scanner Custom Filter is set to Mo.

def Per = ((HighestAll(high)-close)/HighestAll(high))*100;
def Tight = if Per <= 20 then 1 else 0;
plot signal = if Tight then 1 else 0;

What do I have wrong...
close to the up post
how to establish a sell order that is 30% lower that the highest price after buying the stock
this looks like:
=(High price (after buying the stock) minus buy price)X.3 (30%)
and apply that as a trailing stop limit for all stocks
thanks best
 
I have a couple of labels on my chart. One is the Highest price, the second is the percentage off of the high. The labels work as intended. This is used on a Monthly/Max chart.

Labels:

input price = high;
def H = HighestAll(high);
def Per = ((HighestAll(high)-close)/HighestAll(high))*100;

AddLabel(1, "HighestAll = : + H, Color.CYAN);
AddLabel(1, "% Off High = : + Per, Color.CYAN);

I wanted to add this to a scan, to find names that are within 20% of the high. It's returning names that are well beyond 20... The aggregation in the Scanner Custom Filter is set to Mo.

def Per = ((HighestAll(high)-close)/HighestAll(high))*100;
def Tight = if Per <= 20 then 1 else 0;
plot signal = if Tight then 1 else 0;

What do I have wrong?
RangeAll functions (HighestAll, InertiaAll, TotalSum, etc...) will not return reliable results in the Scan Hacker.

RangeAll functions are used to plot calculations based on ALL the bars contained in a chart.
Scan Hacker has no idea how many bars are in your chart or how many bars you would like it to use in its calculations.

Instead of HighestAll, InertiaAll, TotalSum, etc... substitute Highest / Inertia / Sum etc... functions along with a defined set of bars on which to base your calculations.
 
Last edited:
Solution
RangeAll functions (HighestAll, InertiaAll, TotalSum, etc...) will not return reliable results in the Scan Hacker.

RangeAll functions are used to plot calculations based on ALL the bars contained in a chart.
Scan Hacker has no idea how many bars are in your chart or how many bars you would like it to use in its calculations.

Substitute Highest / Inertia / Sum etc... functions along with a defined set of bars on which to base your calculations.
Because I'm looking for the highest the stock has ever traded... And because each stock will have a different length of chart, what I want to do, isn't possible?

And as I'm typing that, it just occurred to me. Is there a problem with saying 1200 monthly bars? Or 100 years? If I'm looking for the highest it's traded in the last 100 or even 200 years, it has still made a highest point in those 2400 monthly bars? If the chart doesn't go back that far, it shouldn't matter, correct?
 
Because I'm looking for the highest the stock has ever traded... And because each stock will have a different length of chart, what I want to do, isn't possible?

And as I'm typing that, it just occurred to me. Is there a problem with saying 1200 monthly bars? Or 100 years? If I'm looking for the highest it's traded in the last 100 or even 200 years, it has still made a highest point in those 2400 monthly bars? If the chart doesn't go back that far, it shouldn't matter, correct?
https://tlc.thinkorswim.com/center/...tudyfilters#:~:text=Data Limitations,20 years
 

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