StockFetcher Forums · General Discussion · Avg high > open % on only up and down weeks<< 1 2 3 >>Post Follow-up
15minofPham
161 posts
msg #160112
Ignore 15minofPham
2/18/2023 1:24:09 PM

I've figured out how to calculate the avg high > open % for all weeks but is there a way to break it down to between up and down weeks?

nibor100
1,008 posts
msg #160114
Ignore nibor100
2/18/2023 6:20:00 PM

Post your filter as it is so far and I'll work on what you now want.

Thanks,
Ed S.

15minofPham
161 posts
msg #160115
Ignore 15minofPham
2/19/2023 12:32:01 AM

Hi Ed,
Here it is. Thanks for looking at it!

set{wclop, weekly close - weekly close 1 week ago}
set{Long_Profit, wclop/ weekly close 1 week ago}
set{wkprofitpct, 100 * Long_Profit}

set{b1, volume - average volume(63)}
set{s1, b1 / average volume(63)}
set{abvavgvol63, s1 *100}

set{c1, weekly high-weekly open}
set{t1, c1/weekly open}
set{highabvopen%, t1 *100}

set{whiop2, weekly high - weekly open}
set{LongProfit2, whiop2/weekly open}
set{highabvopen2%, 100 * LongProfit2}

set{d1a, count(LongProfit2 between .08 and .10, 20)}
set{d2a, count(LongProfit2 between .10 and .15, 20)}
set{d3a, count(LongProfit2 between .15 and .20, 20)}
set{d4a, count(LongProfit2 > .20, 20)}

set{total1, count(LongProfit2 between .08 and .10, 20) + count(LongProfit2 between .10 and .15, 20)}
set{total2, total1 + count(LongProfit2 between .15 and .20, 20)}
set{total, total2 + count(LongProfit2 > .20, 20)}

set{total3, total/20}
set{total%, total3 * 100}

set{diff, close - low}
set{range, high - low}
set{pos, diff/range}
set{daypos, pos *100}

add column wkProfitPct
add column abvavgvol63
add column average day range(21)
add column daypos
add column separator

add column cma(highabvopen%,20)
add column count(highabvopen% above 3%, 100){wkly3%}
add column count(highabvopen% above 5%, 100){wkly5%}
add column separator

add column highabvopen%
add column weekly open
add column weekly high
add column separator

add column total%
add column total
add column d1a{8-10}
add column d2a{10-15}
add column d3a{15-20}
add column d4a{20+}
add column separator

add column count(weekly close > weekly close 1 week ago, 4){up/4}
add column count(weekly close > weekly close 1 week ago, 8){up/8}
add column count(weekly close > weekly close 1 week ago, 12){up/12}
add column count(weekly close > weekly close 1 week ago, 20){up/20}
add column separator

add column RSquared(close,10)
add column RSquared(close,21)
add column RSquared(close,63)
add column RSquared(close,100)

average day range(21) above 1.00
sort column 28 descending

nibor100
1,008 posts
msg #160116
Ignore nibor100
2/19/2023 12:25:16 PM

At first glance, it looks like you can get the totals for down weeks by adding new "add column statements similar to your up4, up8, etc. and reversing the greater than sign.
or
you can make your up4, up8, etc. add column statements into set variables and then just subtract that variable from the counts 4,8,12,20 depending on how many weeks you are interested in covering.

I noticed you have weekly high vs weekly open in some places and weekly close vs prior weekly close in other places which is fine if that's what you intended.

If this doesn't work for you let me know and I'll work the actual filter lines after my grandson leaves town tomorrow.
Thanks,
Ed S.

15minofPham
161 posts
msg #160117
Ignore 15minofPham
2/20/2023 3:11:19 AM

I'm looking for the avg weekly high > open % on up vs down weeks. I'm not sure if SF has the ability to break it down to these two variables.

nibor100
1,008 posts
msg #160118
Ignore nibor100
2/20/2023 11:57:04 AM

Just to double check what you are after:

an up week is defined by weekly close > weekly close 1 week ago
a down week is defined by weekly close < weekly close 1 week ago

so in a 5 week period with 2 down weeks and 3 up weeks
you want the average of the weekly high vs the weekly open for the 3 up weeks
and also the avg of the weekly high vs the weekly open for the 2 down weeks.

are my assumptions correct?

what do you want in the situation where a down week has the weekly high is the weekly open?

Thanks
Ed S.

15minofPham
161 posts
msg #160119
Ignore 15minofPham
2/20/2023 6:50:10 PM

You are correct Ed.

Regarding this: what do you want in the situation where a down week has the weekly high is the weekly open?

Please include it in the avg

nibor100
1,008 posts
msg #160120
Ignore nibor100
2/21/2023 1:49:17 PM

This filter snippet should be what you are after.
Let me know if it is not.
Ed S.

Fetcher[
chart-display is weekly close > 20

set{wclop, weekly close - weekly close 1 week ago}
set{Long_Profit, wclop/ weekly close 1 week ago}
set{wkprofitpct, 100 * Long_Profit}

set{var2, count(weekly wclop > 0, 1)} add column var2{up wk} draw var2
set{var3, count(weekly wclop less than or equal to 0, 1)} add column var3 {down wk}

set{var22, count(var2 > 0, 10)} add column var22{up wks out of 10}
set{var33, count(var3 > 0, 10)} add column var33{down wks out of 10}

set{c1, weekly high-weekly open}
set{t1, c1/weekly open}
set{highabvopen%, t1 *100}

set{c1up, highabvopen% * var2} add column c1up{up wk profit} draw c1up
set{c1dn, highabvopen% * var3} add column c1dn{down wk profit} draw c1dn

set{smc1up, sum(c1up,10)} add column smc1up{up wks profit total 10wks} draw smc1up
set{smc1dn, sum(c1dn,10)} add column smc1dn{down wks profit total 10wks} draw smc1dn

set{var222, smc1up/var22 } add column var222{10 wk mov avg up wks profit} draw var222
set{var333, smc1dn/var33 } add column var333 {10 wk mov avg down wks profit}draw var333
]



15minofPham
161 posts
msg #160121
Ignore 15minofPham
2/21/2023 3:14:33 PM

Great job Ed!
The Up weeks calculations are very close to what I got, but the down weeks are way off so maybe I'm not reading your filter correctly? This is the high > open total I got for TSLA (not including this week) over the past 10 weeks.

Up Weeks
2/13: 11.95
2/6: 10.88
1/30: 11.77
1/23: 32.98
1/16: 8.74
1/19: 5.88
12/26: 5.94
Sum = 88.14
Avg = 12.59

Your totals
Sum = 78.89
Avg = 12.63

Down weeks
1/2: 0.28
12/19: 0.81
12/12: 1.27
Sum = 1.81
Avg = 0.60

Your totals
Sum = 12.63
Avg = 4.21

Thank you so much for helping me on this!


nibor100
1,008 posts
msg #160122
Ignore nibor100
2/21/2023 11:57:42 PM

When I run the posted filter on Friday 2/17, I get the same results as you have listed for the up weeks and down weeks totals and averages.

When I track thru the past week by week I get the individual date values for both up weeks and down weeks that you have listed, though many of the dates are different.
for example you have 2 consecutive up weeks occurring in just 3 days apart 1/19 and 1/16.

And I don't find any of the values you have listed in either of the "your totals" sections
I do notice that the total of 12.63 for down weeks is identical to avg of 12.63, shown for up weeks, perhaps a typo?

I'll check again in the morning as some data providers do adjustments long after the market closes.
Ed S.

StockFetcher Forums · General Discussion · Avg high > open % on only up and down weeks<< 1 2 3 >>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.