StockFetcher Forums · Filter Exchange · VaR Calculation | << >>Post Follow-up |

SAFeTRADE 313 posts msg #112400 - Ignore SAFeTRADE modified |
3/24/2013 10:30:20 AM Kevin would you create a Value at Risk filter to run on a portfolio. I retrieved this from QFinance web site. I am no good at higher math. I find this quite interesting and would like to run it on my portfolio. Value at risk = Mean × HPR + [Z-score × Std Dev × SQRT (HPR)] where Mean is the average expected (or actual) rate of return, HPR is the holding period, Z-score is the probability, Std Dev is the standard deviation, and SQRT is the square root (of time). Clarence |

Kevin_in_GA 3,860 posts msg #112407 - Ignore Kevin_in_GA |
3/24/2013 8:29:27 PMValue at risk = Mean × HPR + [Z-score × Std Dev × SQRT (HPR)]
where Mean is the average expected (or actual) rate of return, HPR is the holding period, Z-score is the probability, Std Dev is the standard deviation, and SQRT is the square root (of time). Clarence ++++++++ I've tried to do this for you, but I think the SF language is (once again) too limiting. I can't seem to get the standard deviation of the daily rate of return to work. Maybe the SF guys are the ones you need to be asking. If they can solve it, please share with the rest of us. |

SAFeTRADE 313 posts msg #112408 - Ignore SAFeTRADE |
3/24/2013 9:09:52 PM Kevin, thank you for trying, I much appreciate your efforts. Tom, Is this something you can put your expertise to? Please respond on this thread so all interested may use it if interested. Clarence |

stockfetcher 963 posts msg #112410 |
3/24/2013 9:32:46 PM Unfortunately, we are not familiar with the specific terms in the formula mentioned. If you can provide the exact price/indicator values required for the measure you are looking for, we would be more than happy to see if this is possible on StockFetcher. StockFetcher Support |

SAFeTRADE 313 posts msg #112411 - Ignore SAFeTRADE |
3/24/2013 10:19:53 PM Tom, I hope this helps. Parametric Example As discussed earlier, The Parametric Model estimates VaR directly from the Standard Deviation of portfolio returns. Volatilities and correlations are calculated directly from user-specified start and end dates. In general terms Parametric VaR can be calculated using the following formula: VaR=Market Price * Volatility. We generally use the term volatility to express a multiple of standard deviation, depending on a chosen confidence level for VaR (i.e., confidence level multiple * standard deviation). Therefore, if we are using a 95% confidence level, volatility refers to 1.65 * standard deviation. (The 1.65 confidence level scaling factor is used because the area under the standard normal curve is between -1.65 and 1.65. If we were to designate a 99% confidence level, volatility would refers to 2.33 * standard deviation. As an example, assume we wish to calculate VaR for a portfolio consisting of only one asset: $1,000,000 of XYZ stock. Assume that the volatility is 1% per day. At a 95% confidence level, with a normal distribution, we can calculate VaR using the following formula: $1,000,000 *.01*1.65=$16,500. This means you have a 5% chance of losing $16,500 over a one day period. If a portfolio is composed of two assets, we must factor in the correlation percentage. For instance, assume a portfolio consists of two positions in Japanese Yen and Thai Bhat, and both currencies positions convert to USD 1,000,000. The volatility for USD/JPY is 1.08%; the volatility for USD/BHT is 1.19%. To calculate VaR at a 95% confidence level, we first multiply 1,000,000 *1.08*1. 65 to obtain 17,800 VaR for the Japanese Yen position. We multiply 1,000,000 *1.19*1.65 to obtain 19, 600 VaR for the Thai Bhat position. The correlation coefficient between the two positions is .55. We can calculate the risk of the two linear positions using the following formula. VaR = square root [(178,000)2 + (19,600)2 + (2 * 55% * 178,000 *19,600)] = $32,935 Thank you, Clarence |

stockfetcher 963 posts msg #112422 |
3/25/2013 12:41:57 PM Thanks for the additional details. Unfortunately, we are not positive that this calculation is possible given the StockFetcher syntax. If possible, can you provide details on how this might be used in a filter or on a chart for a specific symbol? Thanks! StockFetcher Support |

SAFeTRADE 313 posts msg #112431 - Ignore SAFeTRADE |
3/25/2013 3:29:51 PM Tom, It would not be used on a chart although I guess it could. It would be used more in a column as an informational aspect to a stock or etf. I am currently using a simplified alternative to tell me what the max percent daily drop would be at about 97% confidence. If the choice is between 2 stocks and one provides be a greater chance of less than a 3% drop over 100 days, i am going with that one. I am using the following: symlist(spy) set{trigger1, close 1 day ago * .985} set{trigger2, close 1 day ago * .98} set{trigger3, close 1 day ago * .975} set{trigger4, close 1 day ago * .97} set{trigger5, close 1 day ago * .965} set{var1, count(close is below trigger1,100)} set{var2, count(close is below trigger2,100)} set{var3, count(close is below trigger3,100)} set{var3a, count(close is below trigger3,1)} set{var4, count(close is below trigger4,100)} set{var5, count(close is below trigger5,100)} set{var15%, 100 - var1} set{var20%, 100 - var2} set{var25%, 100 - var3} set{var30%, 100 - var4} set{var35%, 100 - var5} add column var15% add column var20% add column var25% add column var30% add column var35% The VaR adds in other factors such as volatility etc. to be a more accurate metric. I think this explains better than I can: Value at Risk (VaR) – a measure to quantify the level of financial risk within an investment portfolio over a specific time frame. For instance, a daily VaR of 3% at a 99% confidence level implies that the portfolio is expected to lose no more than 3% of its total value on 99 days out of 100. VaR is directly derived from historical volatility of returns. Thanks again for your consideration. Clarence |

StockFetcher Forums · Filter Exchange · VaR Calculation | << >>Post Follow-up |

Copyright 2016 - 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