StockFetcher Forums · General Discussion · Dyanmic lowest/highest for X days (variable).<< 1 2 >>Post Follow-up
nibor100
1,052 posts
msg #161451
Ignore nibor100
12/3/2024 12:33:05 PM

Here is my work in progress filter to give you what I think you want
.
The column "varlo3" should give you the lowest low in the past 12 days since the latest/highest High 21 day new high.. ( not in every case yet, but I have some other things to try)

Basically I'm taking consecutive 2 day Low Minimums, storing them in a variable, and then progressing thru 2 day minimums of each succeeding variable.

Let me know if this is kind of what you are after.

Thanks,
Ed S.

Fetcher[
price > 300 vol > 0
high < 21 day new high
add column high 21 day new high
add column days(high is equal to high 21 day new high, 12)
set{varlo, min(low, low 1 day ago)} add column varlo draw varlo /*on plot price*/
set{varlo1, min(varlo, varlo 1 day ago)} add column varlo1 draw varlo1 on plot varlo
set{varlo2, min(varlo1, varlo1 1 day ago)} add column varlo2 draw varlo2 on plot varlo
set{varlo3, min(varlo2, varlo2 1 day ago)} add column varlo3 draw varlo3 on plot varlo
]



rafting101
12 posts
msg #161491
Ignore rafting101
12/18/2024 11:06:40 AM

@nibor100

sorry that I didn't see your message earlier... I didn't realize that there is a new message on "page 2"....

Anyway, thank you for trying, but I don't understand what you are trying to achieve here.

The lines with "varlo", are just lowest low of some value.
for example, if you add to your example:

set{ll5, low 5 days low} add column ll5 draw ll5 /*on plot price*/

you will be able to see that it always has the same value as varlo3

so Its not the algorithm that I'm looking for.

nibor100
1,052 posts
msg #161517
Ignore nibor100
12/27/2024 11:28:56 AM

I ran into complexity issues, so I coded something that might be a little better than whatever your current method for tracking down "the lowest value of the last X days".

The way this filter works is it finds the 21 day high and shows its value in a column.

The next column (DaySincHi) shows how many days have occurred since the latest 21 day High( I only used a 12 day lookback period for this version)

Using the value from that column find the column to the right with the same #, and that value is the lowest Low since the latest High
The DLO column to the right of that column shows how many days since that lowest Low.

When there is a -1 in the DaySincHi column that means the 12 day lookback period I used was not long enough to find the most recent 21 day high.

Hope this helps some,
Ed S.

Fetcher[
price > 300 vol > 0
high < 21 day new high
add column high 21 day new high
add column days(high is equal to high 21 day new high, 12){DaySincHi}

set{varlo1, low 1 day low}add column varlo1 {1} add column days(low is equal to varlo1, 12){DLO}
set{varlo2, low 2 day low}add column varlo2 {2} add column days(low is equal to varlo2, 12){DLO}
set{varlo3, low 3 day low}add column varlo3 {3} add column days(low is equal to varlo3, 12){DLO}
set{varlo4, low 4 day low}add column varlo4 {4} add column days(low is equal to varlo4, 12){DLO}
set{varlo5, low 5 day low}add column varlo5 {5} add column days(low is equal to varlo5, 12){DLO}
set{varlo6, low 6 day low}add column varlo6 {6} add column days(low is equal to varlo6, 12){DLO}
set{varlo7, low 7 day low}add column varlo7 {7} add column days(low is equal to varlo7, 12){DLO}
set{varlo8, low 8 day low}add column varlo8 {8} add column days(low is equal to varlo8, 12){DLO}
set{varlo9, low 9 day low}add column varlo9 {9} add column days(low is equal to varlo9, 12){DLO}
set{varlo10, low 10 day low}add column varlo10 {10} add column days(low is equal to varlo10, 12){DLO}
]







rafting101
12 posts
msg #161538
Ignore rafting101
1/15/2025 3:16:46 PM

nibor100, thanks.
your solution works, but adds calculations and columns in the final display.

I guess its not possible to do it dynamically in stockfetcher.


nibor100
1,052 posts
msg #161539
Ignore nibor100
1/16/2025 11:57:10 AM

Not that I can figure out.

Perhaps their help desk can figure out a way; as they actually gave me a good solution to a problem a few weeks ago. Maybe there is a new help guy.

Ed S.

SAFeTRADE
647 posts
msg #161540
Ignore SAFeTRADE
1/16/2025 2:58:22 PM

You could try working with this. Edit to what suits you. It's a different look at what you are
trying to accomplish.

Fetcher[
set{x4,min(low 5 day low , low 10 day low)}
set{x3,min(low 20 day low ,x4)}
set{btm,x3 * .01}
set{floor,x3 + btm}



set{x2,max(high 5 day high , high 10 day high)}
set{x1,max(high 20 day high ,x2)}
set{top,x1 * .01}
set{ceil,x1 - top}

symlist(spy)

draw x3 on plot price
draw x1 on plot price


draw macd(5,8,13)
draw floor on plot price
draw ceil on plot price

]



StockFetcher Forums · General Discussion · Dyanmic lowest/highest for X days (variable).<< 1 2 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.