StockFetcher Forums · Filter Exchange · Is it possible to get WTD, MTD,QTD,YTD in Stockfetcher<< 1 2 >>Post Follow-up
Honey31
10 posts
msg #161618
Ignore Honey31
3/8/2025 2:15:22 PM

Is it possible to get WTD, MTD,QTD,YTD in Stockfetcher

Mactheriverrat
3,166 posts
msg #161619
Ignore Mactheriverrat
3/8/2025 2:57:43 PM

Seems MTD is the only that's in Stockfetchers feed.

TheRumpledOne
6,498 posts
msg #161630
Ignore TheRumpledOne
3/9/2025 5:26:56 PM

StockFetcher Usage Guide
140
Weekly
By default, all of the measures on StockFetcher are computed using daily data. This means that an
MA(10) would use 10 days of price information to compute one moving average value. On
StockFetcher, it is possible to switch from daily information to weekly by simply adding the
keyword weekly in front of any measure. The following example is a filter using a couple of
weekly moving averages.
Show stocks where the weekly MA(10) crossed above the
weekly MA(50)
Now, when the phrase weekly MA(10) is used, ten weekly price points are used to compute a
single value. On StockFetcher, the weekly price and volume components are computed as
follows:
- weekly close: the last daily close for the week
- weekly open: the first daily open for the week
- weekly high: the highest traded price during the week
- weekly low: the lowest trading price during the week
- weekly volume: the sum of all shares traded during the week
Using the definitions above, a weekly MA(10) would then be computed using weekly closing
values from the previous ten weeks.

TheRumpledOne
6,498 posts
msg #161631
Ignore TheRumpledOne
3/9/2025 5:29:14 PM

Fetcher[

/* VolB - number of days volume below 1,000,000 */
set{VolB, count(volume below 1000000,100)}
VolB below 1

and add column separator
add column exchange
add column industry
add column sector
and add column separator

close is between 0.90 and 2

add column weekly open
add column weekly high
add column weekly low
add column weekly close







]



TheRumpledOne
6,498 posts
msg #161632
Ignore TheRumpledOne
modified
3/9/2025 5:34:17 PM

Fetcher[

/* VolB - number of days volume below 1,000,000 */
set{VolB, count(volume below 1000000,100)}
VolB below 1

and add column separator
add column exchange
add column industry
add column sector
and add column separator

close is between 0.90 and 2

and add column separator
add column open {dayOP}
add column weekly open {wkOP}
add column monthly open {mnOP}

and add column separator
]



MONTHLY is NOT working.




lorypanna
32 posts
msg #161633
Ignore lorypanna
modified
3/9/2025 6:11:57 PM

My contribution, FWIW.

Notes:
- xTD: the filter uses the Open at the beginning of the period 'x' and the Close at the end of the period 'x' (the current / last Close unless 'offset' is greater than zero); maybe this is not the 'correct' way to calculate xTD
- Don't think QTD can be calculated, unless there's some way to identify 'start of Quarter' 's Open

I'm interested to understand what is the 'correct' or 'generally used / accepted' way to calculate xTD.

Cheers from italy.

Fetcher[
/*
NOTES:
1. xTD is calculated as (xEnd_Close - xStart_Open) / xStart_Open
2. xTDP100 = (xTD * 100.0)
*/

offset is 0 days

apply to symlist(SPY, QQQ, IWM, SMH, XBI, DIA, XLF, TLT, XLE, XLK)

/* WTD based on 'weekly open' */
set{MyWCloseW, weekly close}
set{MyWOpenW, weekly open}
set{MyWTDWAbs, MyWCloseW minus MyWOpenW}
set{MyWTDW, MyWTDWAbs divided by MyWOpenW}
set{MyWTDWP100, MyWTDW multiplied by 100.0}

add column separator
add column MyWTDWP100 {WTD%}


/* MTD based on MonthOpen = date(MONTHSTART, open) */
set{MyMOpen, date(MONTHSTART, open)}
set{MyMTDAbs, close minus MyMOpen}
set{MyMTD, MyMTDAbs divided by MyMOpen}
set{MyMTDP100, MyMTD multiplied by 100.0}

add column separator
add column MyMTDP100 {MTD%}


/* YTD based on YearOpen = date(YEARSTART, open) */
set{MyYOpen, date(YEARSTART, open)}
set{MyYTDAbs, close minus MyYOpen}
set{MyYTD, MyYTDAbs divided by MyYOpen}
set{MyYTDP100, MyYTD multiplied by 100.0}

add column separator
add column MyYTDP100 {YTD%}


/* Monthly and Year open prices are plotted on price chart */
draw MyMOpen on plot price
draw MyYOpen on plot price
]



TheRumpledOne
6,498 posts
msg #161641
Ignore TheRumpledOne
3/10/2025 11:34:03 AM

Nice work, lorypanna.

Please share this in the WHAT I HAVE LEARNED thread.

nibor100
1,067 posts
msg #161682
Ignore nibor100
3/13/2025 1:16:12 PM

@lorypanna,

To answer your question about way to calculate "xTD":

Your method is one of the commonly used ways another is

set{MyMOpen1, date(MONTHSTART, open)}
set{MyMTD1, close divided by MyMOpen1}
set{MyMTDP1001, MyMTD1 minus 1}
add column MyMTDP1001 multiply by 100 {MTD%}

Hope this helps,
Ed S.





lorypanna
32 posts
msg #161683
Ignore lorypanna
3/13/2025 6:49:33 PM

@nibor100

Thank you, Ed S.

From what I see, you're confirming my result but doing the calculation in a different way: [ (a - b) / b ] = [ (a / b) - 1 ]. That's good to know for myself.

JFI, I explain why I asked the question: in past I found some traders / platforms that used as the reference price of xTD not the [ open at x ] but the [ close at (x - 1) ], that is the close of the previous candlestick (FWIW, some AI engines confirm this). I understand that the difference often is not so 'important', but I just wanted to clarify to myself if the calculation I'm doing is at least 'common' / 'reasonable' ...

Something new I learned: didn't know I can made a calculation directly in the 'add column' command.

Thanks again and cheers from Italy. lorypanna

nibor100
1,067 posts
msg #161703
Ignore nibor100
3/16/2025 11:29:05 AM

You can even use an add column command to filter the results, for example:

add column MyMTDP1001 multiply by 100 greater than -2 {MTD%}

Ed S.

StockFetcher Forums · Filter Exchange · Is it possible to get WTD, MTD,QTD,YTD in Stockfetcher<< 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.