electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » Discussion » Schmooze
Trading and audio/synthesis
Post new topic   Reply to topic
Page 2 of 3 [53 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3 Next
Author Message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Dec 11, 2009 6:55 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Dec 11, 2009 7:27 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, I have been playing around with this adaptive filter most of the night now and it seems to be showing the beginnings of some hopes of working. In the plot shown below, 500 of 512 points are plotted (only 500 due to an insane limitation of Appleworks 6). The last 20 points plotted are predictive as are the 12 not shown at the end.

As you can see, the algorithm tracks the input closely and when I shut off the input signal to see how it predicts, it settles on the zero axis. This is in agreement with the input data that you cannot see. I do not yet trust the algorithm, however, because it seems to exhibit one of a few behavoirs listed following.

1. It will settle on zero.
2. It will oscillate around the correct solution.
3. It will show a periodic signal which is incorrect.
4. It will not work at all with some input parameter combinations.

I have found by attempting to fit three different segments of the data that I gathered and formatted (which is a bit of effort) that a carefully specified set of input parameters will properly reproduce the signal and predict it for only a very short while. These input parameters do not vary much depending on which of the three sub-data sets that I attempt to model, so that's a good thing.

I should also note that this method requires evenly spaced data samples and the input data is not evenly spaced. It is marked with timestamps that I cannot process without writing a Perl script or something, so what I did was just assume the data was evenly spaced and deal with it that way. This is not kosher and some additional algorithm such as a curve fit or simple interpolation is required to pre-process the data for use by the adaptive filter.

After I read your comments I will take the next step. Advice please?

Les


AdaptiveFilter1.jpg
 Description:
Example of Adaptive Filter 1 Program
 Filesize:  99.1 KB
 Viewed:  385 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

AdaptiveFilter1.jpg



_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Fri Dec 11, 2009 9:39 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24515
Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320

PostPosted: Fri Dec 11, 2009 10:07 am    Post subject: Reply with quote  Mark this post and the followings unread

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Dec 11, 2009 12:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24515
Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320

PostPosted: Fri Dec 11, 2009 2:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
bantri



Joined: May 15, 2005
Posts: 149
Location: brazil
Audio files: 1
G2 patch files: 32

PostPosted: Sat Dec 12, 2009 3:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
It seems essential that filters lag, so how can they be predictive exactly?


Read this one...

VERY good...

http://avaxhome.ws/ebooks/economics_finances/mesa_trading_market_cycles.html
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bantri



Joined: May 15, 2005
Posts: 149
Location: brazil
Audio files: 1
G2 patch files: 32

PostPosted: Sat Dec 12, 2009 3:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website MSN Messenger
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Sat Dec 12, 2009 9:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address
bantri



Joined: May 15, 2005
Posts: 149
Location: brazil
Audio files: 1
G2 patch files: 32

PostPosted: Sun Dec 13, 2009 3:11 am    Post subject: Reply with quote  Mark this post and the followings unread

His new book seems interesting....

http://emini-watch.com/category/john-ehlers/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sat Jul 03, 2010 2:46 am    Post subject: Reply with quote  Mark this post and the followings unread

I got motivated by my brother to work on the trading stuff and wrote a ChucK program to do it. The plot below shows the price of Apple stock from 05 to 07 in blue and the program's model of it in green. The program predicts a gain of $24 and the actual gain is $47. 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...

Les


eChucKTrader1.jpg
 Description:
eChucK Trader Plot
 Filesize:  87.85 KB
 Viewed:  355 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

eChucKTrader1.jpg



_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
bachus



Joined: Feb 29, 2004
Posts: 2922
Location: Up in that tree over there.
Audio files: 5

PostPosted: Sun Jul 04, 2010 6:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here is a respected theorist with a formula. Shocked
_________________
The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham
Back to top
View user's profile Send private message Visit poster's website
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Tue Jul 06, 2010 12:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

bachus wrote:
Here is a respected theorist with a formula. Shocked


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
View user's profile Send private message Visit poster's website AIM Address
bachus



Joined: Feb 29, 2004
Posts: 2922
Location: Up in that tree over there.
Audio files: 5

PostPosted: Wed Jul 07, 2010 5:39 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
nobody



Joined: Mar 09, 2008
Posts: 1687
Location: Not here

PostPosted: Wed Jul 07, 2010 5:42 am    Post subject: Reply with quote  Mark this post and the followings unread

"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
View user's profile Send private message
bachus



Joined: Feb 29, 2004
Posts: 2922
Location: Up in that tree over there.
Audio files: 5

PostPosted: Wed Jul 07, 2010 6:16 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Wed Jul 07, 2010 6:59 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Fri Jul 09, 2010 1:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

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. Smile 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
View user's profile Send private message Visit poster's website AIM Address
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Jul 09, 2010 6:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Sat Jul 10, 2010 11:59 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sat Jul 10, 2010 12:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Sat Jul 10, 2010 12:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sat Jul 10, 2010 3:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Awesome news Howard! That's perfect, but why not Boot Camp?

Les

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18264
Location: Durham, NC
Audio files: 229
G2 patch files: 60

PostPosted: Sun Jul 11, 2010 1:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Sun Jul 11, 2010 2:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic
Page 2 of 3 [53 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Discussion » Schmooze
Jump to:  

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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use