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 1 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: 1, 2, 3 Next
Author Message
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Sat Nov 07, 2009 10:47 am    Post subject: Trading and audio/synthesis Reply with quote  Mark this post and the followings unread

Some small portion of use are interested both in electro-music and trading. We see a tremendous cross-over in these fields. This topic has popped up from time to time at various sub forums. This topic is a place for such discussion.

The motivation to start this topic is here: http://electro-music.com/forum/topic-35453.html

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
julianw



Joined: Jul 30, 2007
Posts: 78
Location: UK

PostPosted: Sat Nov 14, 2009 1:00 pm    Post subject:   Reply with quote  Mark this post and the followings unread

I've been studying automated trading strategies within tradestation for a while now and also see tremendous crossover here. I would like to express my support to this discussion.

I hope to contribute more as my knowledge expands.
Thanks for starting this discussion.
Back to top
View user's profile Send private message
Danno Gee Ray



Joined: Sep 25, 2005
Posts: 1351
Location: Telford, PA USA

PostPosted: Sat Nov 14, 2009 7:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

I too am interested in both.
Back to top
View user's profile Send private message
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Sun Nov 15, 2009 12:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

I figured I wasn't the only one. Smile

Bantri in this topic, http://electro-music.com/forum/topic-35453.html , made some interesting comments about trading but it wasn't well received in the Nord Modular forum. I can see that viewpoint too.

Anyway, I probably should start this off.

I've been using the Tradestation platform for several years. I got it because it is designed for program trading. It supports a neat little language called Easy Language that has enough capabilities for you to develop and code your own algorithms and test them on historical data for virtually any market.

I have found developing algorithms in Easy Language for processing stock price/volume data has taught me a great deal about DSP.

Some people - many very serious intellects with backgrounds in math - have been dismissive with me for trying to analyze random sequences. I have made money but this is considered by them to be anecdotal and their standard come back is, "You will loose eventually."

I don't think stock/future prices are random. They are not predictable, but that isn't the same as random. I prefer to think of these waveforms as chaotic. Chaotic is very different from random; this I've learned from music. A random note generator gets pretty boring rapidly, but a chaos based sequencer, like Les Hall's binary sequencer, or Rob Hordijk's Benjolin, is quite interesting even after a long period of listening. This is because chaotic process settle in on quasi periodic sequences for a while and then suddenly move of into random sounding stuff, before settling in on another quasi periodic period.

I do know one PhD mathamatician from Columbia University that agrees with my thoughts on this. He enjoys talking to me about it, but he has never attempted to develop any algorithms or write any code. He is a spectator. I wonder if he is afraid to jump in because failure might mean he's no good in math. I'm not so afraid. I have failed (and succeeded) many times at many things. Certainly, I would rather succeed than fail, but I'm not attached to either one; at least that is my philosophy.

Others have criticized me for searching for the Holy Grail. The Holy Grail is supposed to give you eternal life, something we have yet to see a single example of here on Earth. A program that makes money has been demonstrated many times. So, I find that Holy Grail analogy not particularly compelling.

One final thought for this post. Many people suggest that you need special knowledge about business to make money in stocks. I think this is true, but not necessary. When I was in the semiconductor business, I made a lot of money investing in companies I knew were making great products and run by smart people; people I met myself. Now I'm retired and away from that world; I don't miss it. I've tried to keep up by watching Bloomberg, CNBC and the like, and reading business magazines. I can't stand that. No amount of money is worth having to spend ones time that way.

I prefer to just look at the price/volume action and just apply algorithms to it. I'm not going to make as much as when a CEO tells me about a new unannounced product. There are always trends to follow and momentum to ride. With programs, you can always stop yourself out quickly to cut your losses.

That's why I prefer to trade rather than invest. Investing is based on belief, trading is based on something else. The most serious losses I've experienced were from good investments.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail 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 Nov 15, 2009 7:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Howard, your mention of applying my Boolean Sequencer to trading is fascinating to me. Perhaps you are thinking of the attached song which I created from two Boolean Sequenced guitar models with similar logic matrices. The patterns sort of repeat, but with subtle changes and the similarity leads to an interesting interplay between the two instruments.

If we could somehow reverse the process - take the music and make a logic matrix which played that music, then we would have a prediction mechanism. The simplest case here would be if we could boil down some aspect of the stock market into a logic table, then we could use logic synthesis techniques to derive the logic table, which in its simplest form is just a sum of products expression. Then when we play back the song a sort of prediction pattern would emerge.

If we must track something like a stock price, then I guess we would convert that price into a binary number for each sample. With a 2^n number of samples, we can then derive logic expressions for each bit. Then we play it back as music and listen for melodies, patterns, anything recognizable and base our stock price prediction upon those things that we noticed.

So I am suggesting that maybe we could sort of reverse-engineer some meaningful trading indicators into music and actually listen to the stock market for clues as to how to trade. Interesting concept. Perhaps we should try a simple test case, though I must admit that I forgot all my logic synthesis techniques, lol. It's worth a shot though I guess.

Les


_Guitar_Lab_Rock1.mp3
 Description:
Demonstration song of Boolean Sequencer, note interplay of two instruments.

Download
 Filename:  _Guitar_Lab_Rock1.mp3
 Filesize:  5.26 MB
 Downloaded:  1331 Time(s)


_________________
"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: Mon Nov 16, 2009 2:56 am    Post subject: Reply with quote  Mark this post and the followings unread

For an example of applying a Boolean Sequencer to trading, let's say we have two indicators: Greed and Fear. That's what drives the stock market in part, right? OK, for simplicity's sake we have quantized the history of Greed and Fear into one bit values, where the bit value as a function of time represents the presence of either. Next let's just do a history of only four samples to keep the example simple. Here is our example data table:

Code:

A B  G F
0 0  0 1
0 1  0 1
1 0  0 0
1 1  1 1


The first two columns are the binary count of time and the second two columns are Greed and Fear. Doing a little logic synthesis, we derive Greed = A&B, Fear = !A | A&B. These are our two sum of product expressions. We then put these expressions into a Boolean Sequencer program, I would use ChucK of course, and we assign a guitar model to play the Greed notes and a drum model to play the Fear notes.

When we play back the song, it has a rhythm that repeats every four notes. We listen to this little song for some kind of musically significant pattern and then use our musical abilities to compose a song that is longer and more complex. This new song becomes our trading predictor. If the new song sounds good and is akin to the nature of the existing song, then perhaps it is a predictor of Greed and Fear patterns.

Or something like that, I don't know, just typing out loud and wondering if this will work. What do you think?

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: Mon Nov 16, 2009 7:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Another interesting thing I just realized is that while demonstrating my Karplus Strong circuit prototype on my radio port for some em friends, we found that if I sped up the stimulus pulse rate so that it was much shorter than the signal decay time, interference patterns caused more complex rhythms than just the two-step stimulus sequence that was applied. (Sorry, overly geeked sentence there.)

Then I thought about this thread and wondered if this circuit could be used to predict complex patterns from simple causes. The feedback loop of a KS circuit kind of represents the reverberation-type effect of world news impacting the stock market for example. If we applied stimulus pulses of positive for good news and negative for bad news, calibrated in height according to the impact of the news on the stock market, then the output waveform might model stock market indicators.

Weird, huh? We'd have to calibrate the delay time and the filter in such a way that they represented elements of the stock market's functioning. Perhaps a more complex feedback arrangement could be made such that it modeled the various forces involved. Delay line = market lag, low pass filter represents something else, I don't know what. Throw in a high-pass filter to model market dynamics like runaway trading or whatever that's called.

Interestingly, this occurred to me while reading Rob's post about his Rungler circuit, so there might be some healthy cross-pollination of ideas going on here. Maybe we can design a circuit that models the stock market somehow and feed in waveforms that represent causal factors, observe the output waveform(s), and make trading decisions based on them. I'm up for coding such a thing in ChucK which would be a rapid way to test the concept.

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: Mon Nov 16, 2009 7:26 am    Post subject: Reply with quote  Mark this post and the followings unread

Oh, um, in other words, we can model the stock market with an analog computer. That sums up the idea in one sentence. Cool

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: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Mon Nov 16, 2009 7:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Les, you are way ahead of me, I never got into logic synthesis. It's used a lot in designing ICs. It's over my head.

I don't think one can model the stock market - certainly not a predictive one. It's just too big a system, and most of the input parameters are huge complex chaotic systems themselves - human beings. By comparison, modeling the weather is trivial. (Excuse the overstatement).

I was referring in my post to your binary sequencer as an example of a chaotic system, not as a model for the stock market. The binary sequencer illustrates the properties of chaotic systems in melody. Rob's Benjolin is a much more complex system that integrates control and audio. I hope you got a chance to play with it at electro-music 2009.

Of interest to any reader of this topic:

If you haven't seen the movie Pi, then go rent it. Uncle Joe Stalin

It's about the prospect of predicting the stock market, if you just had the right model. It's a great movie partly because the sound score is 100% electronic music - Aphex Twin and many others. To me, this puts Pi up there in the class of Forbidden Planet, but with no beautiful women or cute robots.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Inventor
Stream Operator


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

PostPosted: Mon Nov 16, 2009 9:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

Howard, I see what you mean about not being able to model the stock market so I guess I was way off on that one. If there is some way to model a chaotic system that you like in ChucK, then my offer to code it still stands.

Although I did not get to play with a Benjolin at EM09, I did get to meet Rob and we had some nice conversations. The man is a true genius and I'm looking forward to learning how the Benjolin works by reading his explanatory thread in his forum.

Just let me know if there's any way I can help on this project.

Best,

Les

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



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

PostPosted: Tue Nov 17, 2009 1:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

This one is worth reading....

http://articles.mql4.com/163

It talks about binary profit/loss sequences and the martigale strategy...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Thu Nov 19, 2009 12:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

A good article, Bantri. It was like looking at myself, but I don't keep that good records. Smile

My interest is in adaptive filters. Inventer, Les, developed one for his radio broadcasts that works very well. Because he isn't an expert in the field, he came up with a very simple but effective system. I would like to try it on stock prices, but haven't had the time.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
bantri



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

PostPosted: Fri Nov 20, 2009 2:18 pm    Post subject: Reply with quote  Mark this post and the followings unread

One of the best Fourier analysers....

http://codebase.mql4.com/4990



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 MSN Messenger
Inventor
Stream Operator


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

PostPosted: Sat Nov 21, 2009 3:02 am    Post subject: Reply with quote  Mark this post and the followings unread

I can code that for you Howard. The latest release of ChucK has file i/o so if you have the data in a text file I should be able to open it up and process it.

Les

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



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

PostPosted: Sat Nov 21, 2009 11:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hybrid Kalman / Minimax Filtering

http://www.innovatia.com/software/papers/hybrid.htm
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 Nov 21, 2009 11:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Kalman Filter

http://codebase.mql4.com/ru/1362

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 MSN Messenger
bantri



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

PostPosted: Mon Dec 07, 2009 9:17 am    Post subject: Reply with quote  Mark this post and the followings unread

mosc wrote:
My interest is in adaptive filters. Inventer, Les, developed one for his radio broadcasts that works very well.


Where is the PDF paper describing that adaptive filter?

Is it available on the web?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Mon Dec 07, 2009 5:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Maybe Les will chime in here. I don't remember where he put info about it. Probably on the Chuck forum somewhere.
_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
blue hell
Site Admin


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

PostPosted: Mon Dec 07, 2009 5:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

Or it was mentioned in the chat only maybe ...
_________________
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: Mon Dec 07, 2009 10:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

mosc wrote:
Maybe Les will chime in here. I don't remember where he put info about it. Probably on the Chuck forum somewhere.


Hi folks, the adaptive filter is very simple. I would be happy to share the algorithm, and I might have already on the ChucK forum but don't recall if I did. I would be happy to go back and look at the code and type up a verbal description of it or share the code, though I need your advice.

If you think that the filter could be of some value such that it should be known discretely by just a few of us who are interested in it, I can pm or email the info out instead of posting it here. Just let me know.

Best,

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: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

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

Les, with things like this, the best thing might be to keep it close to the vest and test it out on stock price waveforms. Drawings like Bantri has posted show traders how it will perform. The purpose of most trading indicators is to get rid of the noise without getting rid of changes that are real and could be signals to buy or sell.

Chuck probably isn't the appropriate language for trading systems, but most other languages don't provide FFTs.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Inventor
Stream Operator


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

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

OK Howard, I will keep it to myself. If you or someone else can pm or post an example data file of a stock's price over some interval then I can get started coding up a program with this algorithm. I'll share the results but not the algorithm. A CSV text file format would be the easiest, but I'll reformat whatever you may have that's easy to send to me.

Les

At this point in my programming life experience, I have gotten to where the only language that I remain proficient in is ChucK. I have learned about 20 languages to one extent or another in my life, and forgotten most of what I know about the other 19, haha. So I'll do it in ChucK.

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



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

PostPosted: Thu Dec 10, 2009 1:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

have fun...

tonĀ“s of free data here:

http://ratedata.gaincapital.com/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
blue hell
Site Admin


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

PostPosted: Thu Dec 10, 2009 2:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

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?

_________________
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
mosc
Site Admin


Joined: Jan 31, 2003
Posts: 18195
Location: Durham, NC
Audio files: 211
G2 patch files: 60

PostPosted: Thu Dec 10, 2009 3:39 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?

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?


Filters do lag - no question about it. That's the challenge, how to make adaptive filters that respond to signals but not to the noise. In some ways it is a typical telecom signal extraction problem, only more complicated because usually telecom signals have noise that changes slowly over time.

I've heard the argument before that if there was something that worked, people would use it and it would distort the market itself, thereby rendering itself useless. A corollary to that is, if there was an algorithm, everyone would be using it and why would you need to discover it yourself.

The best argument for me is: true by existence. I've read about and actually personally met people who have had great success using systematic methods trading stocks and futures. I myself have had enough luck with it to keep my interest going in this topic.

There isn't a silver bullet that will always be 100% in every situation. At least, nobody has described it if there is. Still, bronze, lead, and steel bullets work quite often.

_________________
--Howard
my music and other stuff
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 3 [53 Posts]
View unread posts
View new posts in the last week
Goto page: 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