| Author |
Message |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Fri Dec 11, 2009 6:55 am Post subject:
|
 |
|
| Blue Hell wrote: | It seems essential that filters lag, so how can they be predictive exactly?
It would be thinkable to have a high Q filter that would "predict" periodic events pretty well, but that assumes periodicity in the data - if those would be present they would be discovered and acted on by speculation thereby destroying the periodicity ... where do I go wrong? |
Here's how I am attempting to make this adaptive filter predictive, Jan. The output data is delayed by a more or less fixed amount that is a function of the algorithm's constants. I take my input data, process it, then time-shift the result by the specified amount and ta-da it lines up with the input data, predicting it retroactively. OK, that's how to kill the lag, but what about the actual prediction? For that I've taken to simply shutting off the input signal and allowing the system to "ring" for a little while. Out pops the prediction.
As to the discussion about any obvious feature must have been found out and corrected for by market forces, yes that is quite valid but I say: "not always". For example, I wrote a few very complicated sports prediction algorithms which anyone can read about by visiting my website at the link below. All the seasoned gamblers told me that once a working gambling system becomes known, the bookies compensate for it and it becomes useless. Yet I was able to triple my money in "pretend" bets, mostly on women's basketball, and also become victorious over close to 20 seasoned gamblers in an NFL prediction contest with a come-from-behind victory at the end of the season. All that with a published algorithm, and I even gave away the software for free download.
So yes, it is possible that as-yet-undiscovered algorithms can still even in this day provide an individual investor with an edge. Will this adaptive noise canceler work? I dunno. Progress report next post.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Fri Dec 11, 2009 9:39 am Post subject:
|
 |
|
Looks like you have been working hard at this, Les. Some comments:
Don't worry about the timestamps of the data. Traders just call each data point a bar. Bars can be monthly, weekly, daily, hourly, all the way down to 1 minute and even less. Trading algorithms generally use any time scale. Weekends and holidays are usually ignored in most cases.
The objective of these algorithms is to generate some sort of trading signal - buy and sell queues. In the case of your algorithm, the time scale seems a little bit fast. You should add, if possible, some sort of slow down to this.
Shifting the result of the algorithm forward in time is done, but not without risks. The lag appears to be eliminated, but it is illusionary.
There is usually some number of samples that must be processed before the algorithm starts to work. If, for example, you are using a 512 FFT, then you should process at least 512 data samples before putting out the first result. If you are using a 50 bar moving average, then it will take 50 bars to get going, so to speak. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24515 Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320
|
Posted: Fri Dec 11, 2009 10:07 am Post subject:
|
 |
|
| Inventor wrote: | | Here's how I am attempting to make this adaptive filter predictive, Jan. The output data is delayed by a more or less fixed amount that is a function of the algorithm's constants. |
Yes I understand, but you can do that for non real time situations only. _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Fri Dec 11, 2009 12:28 pm Post subject:
|
 |
|
To address all four points:
1. There is a smoothing parameter. I will do more smoothing to get a clearer buy/sell decision. I added the "ringing" effect to act as a buy/sell signal. In the above example the dollar goes down then stabilizes, a sell signal.
2. I shifted the output data by a fixed amount equal to one of the input parameters. I understand why the data is shifted by exactly this amount of lag so there should not be a problem. This is why I feel the shifting has minimal risk, but of course it requires much testing.
3. The startup delay is precisely as you stated, Howard.
4. Jan, I felt that this method would not work in real time also when I first tried it, however after playing around with it for hours I thought about it and yes, it works in real time. This is because the computer can run through the calculation almost instantaneously and because all data to the current trade (with some availability delay) is known. It's just a calculation, not a violation of causality. Or did I explain that correctly?
Next up, I have realized that I can run an optimization algorithm to continuously guess at best-fit values of three of the input parameters, and set the fourth one to a known good value. This will automatically tune the algorithm for the given input data.
Further, I can look at the prediction values and determine a buy or sell decision automatically and update it in real time on the screen. I can also produce a numeric strength value to the decision.
By optimizing and deciding, the trader can just run the program continuously and when clear decisions print out then make the trading actions appropriately. I'll keep you posted.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24515 Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320
|
Posted: Fri Dec 11, 2009 2:24 pm Post subject:
|
 |
|
| Inventor wrote: | | 4. Jan, I felt that this method would not work in real time also when I first tried it, however after playing around with it for hours I thought about it and yes, it works in real time. |
Les I understand how it works, and yes it works very fast, and fast enough to cause no noticeable delay in the audio case, but for trading you can not make such a system work as you would really have to look into the future for that to work. _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
|
Back to top
|
|
 |
bantri

Joined: May 15, 2005 Posts: 149 Location: brazil
Audio files: 1
G2 patch files: 32
|
|
|
Back to top
|
|
 |
bantri

Joined: May 15, 2005 Posts: 149 Location: brazil
Audio files: 1
G2 patch files: 32
|
Posted: Sat Dec 12, 2009 3:09 pm Post subject:
|
 |
|
In short... the most important fact in that book is:
Cycles can be predicted as soon as you spot 1/4 of the full cycle... and that fact gives superior predictability when compared with moving averages. |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Sat Dec 12, 2009 9:36 pm Post subject:
|
 |
|
I have Ehler's book, Rocket Science for Traders. Oddly, or maybe not, it is a great book about Digital Signal Processing. He uses the Hilbert Transform a lot.
I read somewhere that you can use Hilbert Transforms instead of Dome Filters to build frequency shifters (the electronic music tool). I wish I could find more information about that somewhere. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
bantri

Joined: May 15, 2005 Posts: 149 Location: brazil
Audio files: 1
G2 patch files: 32
|
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
|
Back to top
|
|
 |
bachus

Joined: Feb 29, 2004 Posts: 2922 Location: Up in that tree over there.
Audio files: 5
|
Posted: Sun Jul 04, 2010 6:44 pm Post subject:
|
 |
|
Here is a respected theorist with a formula.  _________________ The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Tue Jul 06, 2010 12:26 pm Post subject:
|
 |
|
| bachus wrote: | Here is a respected theorist with a formula.  |
He says we are in for a depression - or a big downturn in the markets. I can't argue with that, but I've taken a course on Elliott wave theory. I'm not a believer. You can come up with the same conclusion on this case without that theory. Still, an Elliott wave theorist would be able to make money in a downturn. His warning is for the buy and hold people - most investors and pension funds. Buy and hold is a a bad strategy for many reasons. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
bachus

Joined: Feb 29, 2004 Posts: 2922 Location: Up in that tree over there.
Audio files: 5
|
Posted: Wed Jul 07, 2010 5:39 am Post subject:
|
 |
|
It is my entirely uninformed opinion that markets and society are too irrational and too filled with the unpredictable to be modeled with present knowledge. So I don't take such theories seriously, though I too wouldn't be the least surprised if we were entering a true depression. _________________ The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham |
|
|
Back to top
|
|
 |
nobody
Joined: Mar 09, 2008 Posts: 1687 Location: Not here
|
Posted: Wed Jul 07, 2010 5:42 am Post subject:
|
 |
|
| "Markets" just show off the stupidity of society. We've got people going hungry and homeless in "developed" societies because of "markets". So it's all garbage, and the sooner we get rid of it, the better off everyone will be. |
|
|
Back to top
|
|
 |
bachus

Joined: Feb 29, 2004 Posts: 2922 Location: Up in that tree over there.
Audio files: 5
|
Posted: Wed Jul 07, 2010 6:16 am Post subject:
|
 |
|
| audiodef wrote: | | "Markets" just show off the stupidity of society. ... |
I think that is true, but so far all the altrnatives that have been tried have only shown off society's brutality. _________________ The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham |
|
|
Back to top
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Wed Jul 07, 2010 6:59 am Post subject:
|
 |
|
| bachus wrote: | | It is my entirely uninformed opinion that markets and society are too irrational and too filled with the unpredictable to be modeled with present knowledge. So I don't take such theories seriously, though I too wouldn't be the least surprised if we were entering a true depression. |
Another uninformed opition: on a global scale, predicting market trends ought to be substantially more difficult than predicting the weather - and that's if you manage to keep your predictions outside the market feedback loop (i.e. if someone gets wind of your predictions they become part of the market they are trying to predict, and you're screwed again).
In a more local, regulated scope such as a stock market for some specific good in a small region though, I wouldn't be so quick to dismiss a fine-tuned general purpose human brain, sniffing out trends and where groups of people are heading. I'm pretty sceptical about making a completely automated solution - computer's aren't half as good as people yet when it comes to moving between the whole picture and crucial details therein. But you can write programs to aid your trading intuition.
/Stefan _________________ Antimon's Window
@soundcloud @Flattr home - you can't explain music |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Fri Jul 09, 2010 1:30 pm Post subject:
|
 |
|
| Inventor wrote: | | I figure in this game, a clear buy indicator is a good thing even if it is half-off. Or is that half-baked? I dunno... |
It's hard to tell what is going on from your figure. You x axis is very compact and your indicators are very fat. Also, the buy and sell indicators are not shown.
I have been thinking, but not doing, a lot about this lately. A lot of math experts I know take strong statements that it is impossible to predict the markets. I have been sucked into getting into arguments with them about it. I've come to the conclusion that it's not what this is about at all. The game isn't to predict the market, ie, IBM will be at 100 on September 15th, but to determine the probability of certain possibilities. This may seem obvious to many people, but it isn't.
The procedure of moving your filter's output forward in time is a common one. In and of itself, it's not a bad idea. It give you a prediction. You need to determine probability that the market is close to the predictions your filter makes. Then calculate the risk/reward ratio. That way you can determine if it is reasonable to harvest your market with your system.
Thus, it is possible to quantitatively measure your systems efficiency and effectiveness. I personally have never done this; I've just back tested my system and if it made a significant profit (subjective), I assumed it was a good system.
Aside, I just hear/read that Ray Kurzweil now has a company that is developing and selling automatic trading systems to hedge funds and large organizations. Apparently, the price is 30% of the profits. I guess if you loose money, he doesn't cover 30% of your loses. Ray Kurzweil is a lot smarter than any of the math experts I have discussed this with, so I find this very encouraging. He's also a primo electro-musician. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Fri Jul 09, 2010 6:50 pm Post subject:
|
 |
|
I'm just setting up the program and giving it an initial set of test data to chew on for now. To get a prediction I set the algorithm to continue after the data is done, as you say. Then I look at all the wiggling plots and see if the trend is up or down. This simple Apple 05 to 07 test case is an easy one to predict though, up up up up.
Next I'm going to add file i/o so I can get an online data service and pump their data into the program. But first we are going to select an online brokerage firm and invest in a few stocks that we like. Any recommendations?
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Sat Jul 10, 2010 11:59 am Post subject:
|
 |
|
Without a doubt - Tradestation.
You can sync up your data with your algorithms. The language they use for the DSP is called Easy Language. It's easy, and integrated directly into the data feeds. You shouldn't use ChucK for trading, IMHO, anymore than using Fortran for music. The Easy Language is a standard for this sort of thing and there are millions of free pieces of code you can get from the net, and you can exchange code with others. Also, Easy Language has built in back testing, a parameter optimizer (very useful), and it can make trades for you automatically. It can query you account and determine which trades are open. Trading cost is very reasonable. It is rated highest regularly by trading magazines. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat Jul 10, 2010 12:11 pm Post subject:
|
 |
|
Yes, I really really want to go to a tradestation account when i can afford to buy a pc powerful enough for it. Right now we're only playing with a small amount of money and my bro won't go for the PC. But later when we've got more of a bankroll a PC will be a smaller part of the pie. Until then I will have to piece something together myself and ChucK, strangely, has what's needed I think. I'm just working without a budget for now, so I have to do a custom job.
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Sat Jul 10, 2010 12:21 pm Post subject:
|
 |
|
You really do not need a powerful PC for Tradestation. I run on a very modest one running XP. You can run it on your Mac, BTW. People have had great luck using Parallels and Boot Camp. I'd go with Parallels myself. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat Jul 10, 2010 3:11 pm Post subject:
|
 |
|
Awesome news Howard! That's perfect, but why not Boot Camp?
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
mosc
Site Admin

Joined: Jan 31, 2003 Posts: 18264 Location: Durham, NC
Audio files: 229
G2 patch files: 60
|
Posted: Sun Jul 11, 2010 1:31 pm Post subject:
|
 |
|
Well, you can run Tradestation, or any other windows app in a window while running OSX. Bootcamp is a dual boot solution, which is cool too, of course. I've seen a video on the web where someone is using Parallels with Tradestation. I've been trying to find that but haven't had any luck yet. _________________ --Howard
my music and other stuff |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun Jul 11, 2010 2:40 pm Post subject:
|
 |
|
OK that is a good reason to use Parallels. Also the link you gave me in chat demonstrates it on video very nicely - and in text. Now my only question is that my Mac mini has only 2Gigs of RAM, so do I need to get an XP disk or can I get a Windows 7 disk?
Les _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
|