SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Apr 06, 2020 12:21 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Jan 16, 2011 12:40 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 236
Hi,

Are there any tutorials available on how to generate a probability distribution from a given set of tick data?

Also how can I build a data provider to generate data on the fly from this probability distribution?

I am specifically referring to this comment:

"Another approach, which is more elegant and powerful in my view, is to develop a simple data provider that will generate new data on the fly in memory from probability distribution. This should also be much faster."


Top
 Profile  
 
PostPosted: Sun Jan 16, 2011 2:01 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

since it's a bit tricky to use a custom data provider in the simulation mode, I suggest you look into the new Scenario feature. This FAQ viewtopic.php?f=64&t=8627 discusses a scenario for walk-forward analysis. Monte-Carlo simulation is more or less the same thing. A Monte-Carlo simulation scenario would look like

- read data series for instrument XXX and build a probability distribution function of its returns
- create an instrument YYY
- add instrument YYY in the strategy instrument list

for number of Monte-Carlo simulations do

- clear historical data series for YYY
- write simulated data series for YYY using probability distribution function of XXX
- start backtest for YYY
- add final wealth, Sharpe ratio or max drawdawn to the list of results

end for

- analyse the list of results (build distribution histogram)

We can probably create a real code sample for this scenario and add it to the FAQ.

Regards,
Anton


Top
 Profile  
 
PostPosted: Sun Jan 16, 2011 3:44 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 236
Thanks for that, I will give it a go.

A code example of this would be a great help too, when you have time.

Regards

Akhil


Top
 Profile  
 
PostPosted: Sun Jan 16, 2011 3:47 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
I think we should add Histogram and Histogram2D from the underlying SmartQuant framework to OpenQuant API . This would help with data analyisis.

Image

Image


Top
 Profile  
 
PostPosted: Sun Jan 16, 2011 6:47 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

I am trying to develop a scenario for Monte Carlo backtesting. I understand how to simulate a price series using return distribution histogram of the original data series.

Now let's assume we want to simulate a series of bars.

i-th Close price in the simulated series is then Close[i-1]*R[i], where R[i] is return that we calculate for each i from the distribution histogram using Monte Carlo method.

My question is how we can simulate High and Low? I can think about building distributions of Close/High and Low/Close ratios of the origianal series and then simlating H[i] and L[i] from these distributions, and then High[i] = Close[i]/H[i] and Low[i] = L[i]*Close[i] but it sounds a bit complex.

Is there a better method?

Any suggestions / references?

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Jan 20, 2011 4:29 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 236
Hi,

Have you considered producing a price time series from a much smaller time period say 1 minute intervals using a Monte Carlo engine. Slightly unsure about the statistical validity of this idea but I haven't thought of any arguments about why this cannot work.

This price series could then be used to generate bars of a larger time period and hence generate highs and lows automatically.

The problem will be that the produced bar series will probably be unlikely to look like any historical sample. Relaxing weak form efficiency by adding a "momentum element" to the stochastic process (generalized weiner process) may well produce a more realistic result.

Also markets close at regular intervals so this would also need to be accounted for. Since the volatility of the difference between close and open of the following day is probably quite different to the market volatility during open hours this will have to be incorporated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group