|
CraigBennett
 New User
Posts: 2
Joined: 7/10/2024
Location: Wentzville, Missouri
User Profile |
I’ve been trying to figure out how to scan for stocks making new 60-day highs. Something like price is > highs of past 60 days. Doesn’t have to be 60 days, just fiddling with an idea I read about. If we can’t filter for days, two months would work.
Any ideas?
Thanks,
Craig
|
|
Etherist
 Member
 Posts: 25
Joined: 6/9/2024
Location: South Australia
User Profile |
Hey there Craig
From an OmniScan perspective, you could use: h > hhv(60)[1]

or use an Indicator as below:
Try out the attached code for something that might work for you.
=================================================================
1. Parameters:
- Length: Specifies the number of days to look back. Default is 60 days, adjustable from 1 to 365 days.
2. Script Explanation:
- Initialization:
- `HHigh`: Variable to store the highest high observed within the specified period.
- `Period`: Variable to hold the value of the parameter "Length" (number of days to look back).
- Finding Highest High:
- The script initializes `HHigh` to the lowest possible value (`L`).
- It loops through each day within the past `Period` days (`1` to `Period`).
- During each iteration, it compares the high price (`H`) of that day with `HHigh` and updates `HHigh` if `H` is higher.
- Comparison and Plotting:
- After determining the highest high (`HHigh`) over the past `Period` days, the script compares the current closing price (`C`) with `HHigh`.
- If the current price (`C`) is greater than `HHigh`, it plots the current price as "New 60-Day High" in green.
- Otherwise, it plots the current price as "Not a 60-Day High" in red.
3. Return Statement:
- The script returns the value of `HHigh`, which represents the highest high observed over the past `Period` days.
====================================================================
Cheers Etherist :-)

[Edited by Etherist on 7/10/2024 11:20 PM]
Attached file : 60DayHigh.txt (0KB - 62 downloads)
Attached file : 60 Day High.jpg (135KB - 151 downloads)
Attached file : 60 Day High OmniScan.jpg (50KB - 152 downloads)
|
|
CraigBennett
 New User
Posts: 2
Joined: 7/10/2024
Location: Wentzville, Missouri
User Profile |
Wow, thanks a bunch for terrific reply! More than I asked for.
Kindest regards,
Craig
|