R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices - Matlab, R project and Python | futures.io
futures.io futures trading

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > Matlab, R project and Python

R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices
Started:August 31st, 2014 (05:32 PM) by Big Mike Views / Replies:513 / 2
Last Reply:September 1st, 2014 (06:23 PM) Attachments:1

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices

Old August 31st, 2014, 05:32 PM   #1 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,444 since Jun 2009
Thanks: 28,847 given, 79,583 received

R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices

I found this interesting so am cross-posting it from Quant Stack Exchange.

Source: r - one-step-ahead Stochastic Volatility for 5-minute VWAP prices - Quantitative Finance Stack Exchange

If anyone can comment on the accuracy of the formula, please do so either here on futures.io (formerly BMT) or on the original question URL.

I'm trying to run an SV model against prices of Euro/USD. For those not familiar with SV, its a volatility model in which each point gets its own volatility parameter ht with 3 main parameters that are derived using a monte carlo simulation (MCMC),

μ = average of the volatility across the entire sample set
ϕ = the weighting that the volatility of the last point has on thenext (predicted) volatility
ht = the most recent - {time interval}'s volatility.
σ = volatility of the volatility
Once we have μ, ϕ, and ht we can predict ht+1, that is, the predicted volatility of the next point, by ht+1∼Normal(μ+ϕ(ht−μ),σ).

I'm wondering if I'm doing the next part correctly:

To put this into practice, we run a MCMC every 5 minutes, gathering those variables and predicting ht+1. This results in a graph like this, for CME futures contract 6EU4 (September euro) with 5-period BBands also displayed. Ignore the shapes that appear on the graph.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

It feels inaccurate, so I'm not sure if I'm doing something wrong. Did I understand the process correctly? phi is around .55 for the first half of the day, then jumps to .95 and stays there, which seems wrong, but I guess it isn't too surprising given the data...

R's package stochvol is taking care of the parameter estimation, so assume that the numbers themselves are accurate.

Should I paste the 5-minute Volume Weighted Average Prices here? its a pretty long data set. I'll edit it to do that if so.


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:

Old August 31st, 2014, 05:32 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old September 1st, 2014, 06:23 PM   #3 (permalink)
Trading for Fun
Buffalo, NY
Futures Experience: None
Platform: Python, Excel, R, Ninjatrader
Broker/Data: IB quandl
Favorite Futures: Low frequency trading
Posts: 64 since Jul 2014
Thanks: 4 given, 37 received

Looks really interesting.

Here is a test script pieced from the manual. I have no idea about the actual question though.


stockData <- new.env()
startDate = as.Date("2004-01-13")
endDate = as.Date("2014-08-25")
tickers <- c("SPY","QQQ")
getSymbols(tickers, env = stockData, src = "yahoo", from = startDate, to = endDate)

ret <- dailyReturn(stockData$QQQ,type='log')

res <- svsample(ret, priormu = c(-10, 1), priorphi = c(20, 1.1),priorsigma = .1)

volplot(res, forecast = 100)

Attached Thumbnails
R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices-stochvol.jpeg  
Reply With Quote
The following 2 users say Thank You to NoiseTrader716 for this post:


futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > Matlab, R project and Python > R - one-step-ahead Stochastic Volatility for 5-minute VWAP prices

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Buckle Up: More Volatility Ahead for Stock Market Quick Summary News and Current Events 0 February 26th, 2013 10:50 PM
How to take the VWAP little v off beside matrix prices? r3algood TradeStation 2 July 31st, 2012 01:26 PM
No Shocker, More Volatility Ahead for Stocks Thursday Quick Summary News and Current Events 0 August 11th, 2011 01:00 AM
Week Ahead: Debt Talks, Earnings Will Whip Up Volatility Quick Summary News and Current Events 0 July 17th, 2011 06:10 PM
Week Ahead: Expect Volatility as Fed Yanks Security Blanket Quick Summary News and Current Events 0 June 24th, 2011 11:40 PM

All times are GMT -4. The time now is 06:50 PM.

Copyright © 2016 by futures.io. All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-25 in 0.08 seconds with 20 queries on phoenix via your IP