StockFetcher Forums · General Discussion · Sort by weighted average<< >>Post Follow-up
mrjas001
5 posts
msg #117384
Ignore mrjas001
12/16/2013 9:27:24 PM

How can I sort on an average of several months Chg(%)?

e.g. 1mo Chg(%) + 3mo Chg(%) + 6mo Chg(%)+1yr Chg(%)

apply different weightings to each time period

four
5,087 posts
msg #117385
Ignore four
modified
12/16/2013 10:22:22 PM

Remember all months do not have the same number of trading days
Using Kevin's idea of ROC and 21 days = 1 month, etc...

Perhaps this will get you started with the pattern (Used only 2 variables and both add to 100% -- z is the third variable)...
Remember only 2 items per SET. Another variable (ROC) will need to be created and then added to the z variable to get three weighted ROCs.


Fetcher[
/* 1 month weighted at 80%*/

set{1m, roc(21,1) * .80}

/* 2 months weighted at 20%*/

set{2m, roc(42,1) * .20}

/* add them together */

set{z, 1m + 2m}

/* present column value of z */

add column z

/* present line chart of z */

draw z
]



StockFetcher Forums · General Discussion · Sort by weighted average<< >>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.