tag:blogger.com,1999:blog-261139923818144971.comments2018-02-16T10:47:04.612+00:00Investment IdiocyRob Carvernoreply@blogger.comBlogger1327125tag:blogger.com,1999:blog-261139923818144971.post-40450649541895094212018-02-16T10:47:04.612+00:002018-02-16T10:47:04.612+00:00It does sound weird. I have done a similar exercis...It does sound weird. I have done a similar exercise but I can't remember what range of volscale I used. I didn't do it very scientifically but if I toned the vol scale down too much then I stopped seeing 'realistic' looking price series (and also the Sharpe Ratio of the ewmac pairs became unrealistically high). I haven't really got time to dig into this, but my approach was basically to generate some results with simulated data and then check they were roughly in the right ball park with real price data.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-27707517875371184712018-02-15T20:06:48.145+00:002018-02-15T20:06:48.145+00:00Well, this is interesting, if I have done things c...Well, this is interesting, if I have done things correctly. Using simulated data, if I use a volscale of ~ 0.16 (to amplitude) and take out the fastest and slowest rules plus focus only on trend frequencies of 1-6 pa, turnover doesn't vary that much (still varies more than I would expect). However when I lower the volscale to 0.02 and look at wider ranges, turnover varies quite a bit. Taking the ewmac2,8 as an example and looking at a trend frequency from once every three years to once a month, the turnover falls from 57 to 18. Its also slightly counterintuitive to me that turnover would fall if trend frequency goes up. Could this be correct? I could have done something fatally wrong, but if not, would it be correct to think that simulated turnover has some limitations (given that I have no idea what the correct 'harmonic frequency', as you put it, will be). Happy to send across a small table of results by email or through whatever channel which might allow formatted tables to be read easily.Patrickhttps://www.blogger.com/profile/01034323689613977187noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-38260030050088080412018-02-15T15:17:41.032+00:002018-02-15T15:17:41.032+00:00This comment has been removed by the author.Kamal Murarihttps://www.blogger.com/profile/12326045785649560867noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-25012733369482545992018-02-14T16:19:39.179+00:002018-02-14T16:19:39.179+00:00Great - many thanks.
:-) that's just the firs...Great - many thanks.<br /><br />:-) that's just the first few from the list for pre-screeningUnknownhttps://www.blogger.com/profile/16298595561202011089noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-5289114982384222392018-02-14T16:08:01.299+00:002018-02-14T16:08:01.299+00:00I think the spreadsheet is correct - the graphs lo...I think the spreadsheet is correct - the graphs look more realistic.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-80620133014022387402018-02-14T14:53:16.113+00:002018-02-14T14:53:16.113+00:00Thanks Rob, I have looked at your spreadsheet here...Thanks Rob, I have looked at your spreadsheet here https://tinyurl.com/ycs8lmp3 and the github code and as far as I can tell they seem to be generating different price processes. The code produce a price path with gaussian 'error' overlayed, whereas the spreadsheet produces a price path along the lines what I think I stated above which is the cumulative(drift + error). I don't know if the code needs correcting or the spreadsheet. Patrickhttps://www.blogger.com/profile/01034323689613977187noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-28309451446416739262018-02-14T11:38:10.422+00:002018-02-14T11:38:10.422+00:00https://github.com/robcarver17/systematictradingex...https://github.com/robcarver17/systematictradingexamples/blob/master/commonrandom.pyRob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-12064411668954563352018-02-14T11:03:35.855+00:002018-02-14T11:03:35.855+00:00Fantastic presentation, thanks. So I am now trying...Fantastic presentation, thanks. So I am now trying to recreate trending markets at different frequencies. Question I have is how to superimpose noise on the sawtooth. The sawtooth is the cumsum of all drift terms, so noise should also be the cumsum of noise?Patrickhttps://www.blogger.com/profile/01034323689613977187noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-78126611482198351232018-02-14T10:45:15.565+00:002018-02-14T10:45:15.565+00:00I'd use an average of the 'mean' acros...I'd use an average of the 'mean' across markets weighted by how much data you have for each market (so BCO would get less of a weight than AUD/USD).<br /><br />(Interesting selection of markets there...)Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-69935422692434873362018-02-14T09:11:42.206+00:002018-02-14T09:11:42.206+00:00Not sure if the formatting will work, but below ar...Not sure if the formatting will work, but below are some further examples of what I'm referring to re max round trips per year. Would be v interested in your view regarding the best number to use. Many thanks.<br /><br /> Min Max Mean Median SD Latest<br />AUD/CAD 20 29 24.627 25 2.5863 27<br />AUD/JPY 42 52 47.6032 48 2.4432 43<br />AUD/USD 35 46 38.9087 39 2.594 43<br />BCO/USD 34 68 45.2659 43 9.2923 58<br />CHF/JPY 31 42 35.7262 35 2.8815 32<br />CORN/USD 4 6 4.8532 5 0.5974 5<br />DE10YB/EUR 35 46 39.3135 39 2.6602 36<br />DE30/EUR 80 122 101.8135 103 10.1852 116<br />EU50/EUR 25 33 29.0913 29 2.0733 31<br />EUR/AUD 35 49 39.0952 38 3.3977 44<br />EUR/CAD 34 44 38.7103 38 2.5294 40<br />EUR/CHF 14 30 17.6944 15 4.9866 28<br />EUR/GBP 41 50 44.6468 45 1.7533 45<br />EUR/JPY 49 66 56.2857 57 4.0136 60<br />EUR/NZD 22 37 26.119 25 4.1238 34<br />EUR/USD 46 57 50.25 50 2.3458 53<br /> Unknownhttps://www.blogger.com/profile/16298595561202011089noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-32795133416393568932018-02-13T17:59:59.501+00:002018-02-13T17:59:59.501+00:00Duh. Sorry, I used the wrong terminology. I was al...Duh. Sorry, I used the wrong terminology. I was alluding to this passage: <br />"So dividing 0.13 by the standardised cost of an instrument will give you the turnover speed limit for that instrument. For a relatively cheap futures market like the Euro Stoxx this implies a maximum turnover of 0.13 รท 0.002 = 65 round trips per year"<br /><br />I'm seeing a lot of variation in the maximum number of round trips per year.Unknownhttps://www.blogger.com/profile/16298595561202011089noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-34687248368103640652018-02-13T16:37:04.702+00:002018-02-13T16:37:04.702+00:00The speed limit shouldn't be 'number of tr...The speed limit shouldn't be 'number of trades per time period'; it is expressed in the book as 'maximum expected cost in Sharpe Ratio units'. This should be fairly similar over time.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-37375517737469527812018-02-13T13:33:01.262+00:002018-02-13T13:33:01.262+00:00Apologies if this is the wrong place, but I couldn...Apologies if this is the wrong place, but I couldn't find a reference to "speed limit" anywhere else on the blog. In Chapter 12 of Systematic Trading you introduce the concept of a speed limit as a means of controlling costs (lovely idea). My question is which value of speed limit do you actually use when automating your trade placement? The most recent value? <br /><br />The reason I ask is that when I coded the speed limit up (using a 36 pd EMA for the SD of returns)), I noticed a wide spread of values over time, dependent on volatility. e.g. (using Oanda daily data for the Dow 30) I get a current max number of trades per year of 182 (recent equity market volatility), but with a one year lookback the min is 25, the max is 234, the median is 34 and the SD nearly 50. <br /><br />Given that volatility can significantly change the speed limit value during the life of an open trade, I'm wondering whether either a longer EMA or using the median speed limit might be better than using just the latest speed limit value? Many thanks. (And apologies if this comment shows up as being from Unknown, I keep logging into my Google account to post, but my name (Andy) never seems to show up.<br />Unknownhttps://www.blogger.com/profile/16298595561202011089noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-63423230543080510672018-02-13T13:26:06.326+00:002018-02-13T13:26:06.326+00:00Using random data to estimate turnover is an excel...Using random data to estimate turnover is an excellent idea, and one I have talked about (i.e https://www.youtube.com/watch?v=s2NSlxHq6Bc ) and blogged about (https://qoppac.blogspot.co.uk/2015/11/using-random-data.html).Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-85970137660464402992018-02-13T12:03:46.479+00:002018-02-13T12:03:46.479+00:00Thank you Rob. With regard to estimating expected ...Thank you Rob. With regard to estimating expected turnover for a each rule variation, rather than using real data, I wonder if it is best to fix these simply with the help of simulated gaussian returns? Otherwise, if we are removing rules based on speed thresholds, and if estimated speeds vary as we change our window of observations, it is possible to end up with changing rule sets for an instrument over time and in different backtests. Could be done but it seems overkill and also I personally can't see why expected turnover should vary over time for a given rule. I am probably preaching to the converted in CH3, I get the impression this is exactly what you recommend doing? <br /><br />As you can see I am still thoroughly enjoying (re) reading your excellent book. Patrickhttps://www.blogger.com/profile/01034323689613977187noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-46049587451208304422018-02-12T10:33:57.721+00:002018-02-12T10:33:57.721+00:00Yes you're right about this being an approxima...Yes you're right about this being an approximation.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-36454817713476063152018-02-11T12:15:47.597+00:002018-02-11T12:15:47.597+00:00Hi Rob,
I saw that on page 196 of Systematic Trad...Hi Rob, <br />I saw that on page 196 of Systematic Trading, third para, you indicate that we can approximate turnover of combined forecasts by taking the weighted average turnover of the individual forecasts. I assume this is in fact intended as a means to get a quick approximation as I would think the 'turnover of the weighted average forecasts' to be lower than the 'weighted average of the individual turnovers' (due to imperfect correlation)? As a crosscheck, tentatively, I think I managed to verify this via a quick comparison using random returns data. Patrickhttps://www.blogger.com/profile/01034323689613977187noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-32603889309240965242018-02-10T21:30:42.449+00:002018-02-10T21:30:42.449+00:00I'm fairly happy sending orders back and forth...I'm fairly happy sending orders back and forth.. exactly once until the connection drops and the client can connect anymore to this clientid. Seems to be an error w/ orderStatus() <br /><br /> File "/home/ubuntu/IBJts/source/pythonclient/ibapi/decoder.py", line 133, in processOrderStatusMsg<br /> avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld, mktCapPrice)<br />TypeError: orderStatus() takes 11 positional arguments but 12 were given<br />Unknownhttps://www.blogger.com/profile/04540724772854497144noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-59458175105358214512018-02-06T08:30:39.291+00:002018-02-06T08:30:39.291+00:00You shouldn't expect this to increase or decre...You shouldn't expect this to increase or decrease your profits but it is true to say that adding more information (eg intra-day price movements) should give you a better forecast of volatility; so if you measure expected versus realised vol it will probably come out slightly better<br /><br />Having said that you aren't comparing apples with apples; your measure will indeed be biased compared to a daily standard deviation of returns, so you should adjust your risk target to compensate for thisRob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-51689505642437915202018-02-05T18:02:22.251+00:002018-02-05T18:02:22.251+00:00Robert,
In trading I see that intraday price volat...Robert,<br />In trading I see that intraday price volatility is more than expected by standard deviation of daily returns. I think it's because only day close prices are used. What if I get daily volatility in different way, based on returns, which are maximum price move from previous close? I.e. I use High, Low of current day and Close of previous day and I compare abs(High/Close - 1) vs abs(Low/Close - 1) to get bigger, but store its value with sign, not abs. Then EMA smoothing as usual. I've tested the method and for my instruments it shows volatility about 30% more than original method. It enables to avoid big capital moves intraday, but, I cannot understand, it decreases profits or doesn't decrease, because capital used to get positions becomes smaller...<br /><br />What do you think?<br /><br />Sincerely, JuliaJuliahttps://www.blogger.com/profile/03304809879316906940noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-82753426218691986092018-02-02T08:27:45.475+00:002018-02-02T08:27:45.475+00:00Yes that's roughly correct, although the '...Yes that's roughly correct, although the 'looking at portfolio every hour' is an over complication that isn't really necessary - daily is fine.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-25975679200937209512018-02-02T08:14:48.624+00:002018-02-02T08:14:48.624+00:00To be honest, I have no way of checking if it is o...To be honest, I have no way of checking if it is or not.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-82070628393775565122018-02-01T19:56:30.979+00:002018-02-01T19:56:30.979+00:00Thank you for the answer :)
Sorry, I'd like to...Thank you for the answer :)<br />Sorry, I'd like to clarify.<br />Am I correct in my understanding:<br />1. You calculate positions for every instrument by last daily closing prices, for example, you get positions sizes for three instrument portfolio: 100, 150, 300. And then you get current price for each instrument and buy or sell to get position as you calculated at closing prices, and the current prices aren't used.<br />2. Each hour you look at your portfolio worth and change positions with some multiplier (>1, if the portfolio increases its worth and <1, if portfolio loses some money), but ratio between positions sizes doesn't change. For example, at some monent the portfolio worth increased in value by 2%. You multiply all positions by 1.02 and get now: 102, 153, 306 (let's ignore position inertia) and buy 2, 3 and 6 new futures contracts. But you don't use current prices to calculate new optimal portfolio positions, which could change positions in some other way, for example, decreasing the first instrument position and increasing the second one.<br />I'd like to understand details correctly )<br /><br />Sincerely, Julia.Juliahttps://www.blogger.com/profile/03304809879316906940noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-21527927679927086562018-02-01T19:54:51.016+00:002018-02-01T19:54:51.016+00:00Would you say, this example looks correctly?:
http...Would you say, this example looks correctly?:<br />https://imgur.com/a/x65QcSeq uoiahttps://www.blogger.com/profile/06444242368321151400noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-26902115966161723822018-02-01T11:08:54.680+00:002018-02-01T11:08:54.680+00:00Many thanks for the reply. Re your point on "...Many thanks for the reply. Re your point on "the distributional properties of the underlying forecast", the default function I'm using assumes a normal distribution, but I suppose (once enough predictions have accumulated) once could base the cdf on the actual distribution, rather than assuming a normal one?<br /><br />Many thanks also for the warning re the long run average. Will try to resist the temptation to optimise the average length...<br />Unknownhttps://www.blogger.com/profile/16298595561202011089noreply@blogger.com