Pages:
Author

Topic: Trading Bots - page 3. (Read 12990 times)

legendary
Activity: 1190
Merit: 1004
April 07, 2012, 09:58:27 AM
#44
Well I modified the code:

Quote
int main (int argc, const char * argv[]) {
   float usd,btc,bid,ask,order_price,possible_price;
   printf("HALLO\n");
   DateData * prices = load_prices();

It never prints HALLO and it now crashes o the printf line...
legendary
Activity: 1904
Merit: 1002
April 06, 2012, 11:15:29 PM
#43
OK but what is wrong with this line?

Code:
FILE * file = fopen("price.dat", "rb");

That's as perfect as a line of code can be. It makes me think the compiler is corrupting the program somehow.

Or you have a bad pointer somewhere and C won't stop you from overwriting your code stack and screwing up the instructions, leading to an error being identified in a bit of code that was fine before the program did exactly what you told it to do.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 05:53:19 PM
#42
OK but what is wrong with this line?

Code:
FILE * file = fopen("price.dat", "rb");

That's as perfect as a line of code can be. It makes me think the compiler is corrupting the program somehow.
sr. member
Activity: 461
Merit: 251
April 06, 2012, 11:11:28 AM
#41
I'm using C.
... so check your pointers. Make sure nothing is pointing to the stack and so on.

Yes, definitely a pointer issue.  The problem with set faults and pointers is that the seg fault can often occur at misleading places leading you to believe that the bug is located at a different point in the code.  And C gives little to no warning when playing with pointers improperly.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 08:07:39 AM
#40
I'm using C.
... so check your pointers. Make sure nothing is pointing to the stack and so on.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 07:43:34 AM
#39
Code:
(*PPO_results)[x]

This is is not a C++ object. I'm not even using C++, I'm using C. The type is CombinationResult[PPO_COMBINATIONS * 11].

Also I don't know why declaring several variables on one line is bad style...
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 07:15:43 AM
#38
Code:
(*PPO_results)[x]
is a valid object?
Make sure all objects used are initialized plus not yet released.

Is it possibly an
Code:
extern "C" {
issue?

p.s.
Code:
float usd,btc,bid,ask,order_price,possible_price;
Bad style I´d say.
Not so much of an issue on basic types, but still.
My Grandma used to say: "Wokeen Grössn ni eert ward n Daaler ni weert!" meaning don´t be sloppy even not on little things.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 05:52:56 AM
#37
Forgot about that, it's a structure with an int and float.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 05:39:03 AM
#36
What is a CombinationResult? ... possibly a pointer?


legendary
Activity: 1190
Merit: 1004
April 05, 2012, 07:23:00 PM
#35
I'm currently unable to test that but that should not be the case. It works when I return from the other function before the suspected bad line occurs.
sr. member
Activity: 461
Merit: 251
April 05, 2012, 06:47:52 PM
#34
I updated my algorithm in attempt to get it to test for consistency over different time periods and also use use more data but unfortunately it has a weird problem. http://stackoverflow.com/questions/10036739/line-of-c-code-causes-a-segmentation-fault-on-a-completely-irrelevant-line-of-co  Huh

Don't you just need to define

Quote
FILE * file;

first and then do the

Quote
file = fopen(....

on a separate line?
legendary
Activity: 1190
Merit: 1004
April 05, 2012, 06:23:31 PM
#33
I updated my algorithm in attempt to get it to test for consistency over different time periods and also use use more data but unfortunately it has a weird problem. http://stackoverflow.com/questions/10036739/line-of-c-code-causes-a-segmentation-fault-on-a-completely-irrelevant-line-of-co  Huh
donator
Activity: 2058
Merit: 1007
Poor impulse control.
April 04, 2012, 10:56:55 AM
#32

Thanks organofcorti, I'm reading up about it now. I've been programming for a little while but have never heard of R, even for statistical analysis. How come it isnt more mainstream? I've heard of languages such as K and Q which seems to be used fairly widely for banks processing tick by tick data however trading strategies tend to be predominantly done in C.

Do you have an overview of the pros/cons of R, and how it compares to the others. I wanna get a bit more of an idea what the language is like before investing serious time into learning it.

Can it interface easily with PHP and/or the existing API's to automatically place trades?

I'm not a good person to ask. Apart from R I've done a little C, python, and basic and that's about it (I can feel my kudos disappear as I write shudder). But I like R, it's extensible, flexible, has error messages that actually help you find bugs, and can do everything I need it to. I've scraped webpages with it, and stochastic wrote some code that interfaces with bitcoinica (posted here.

Another good upside is that it's been around in one form or another for decades. There's not one question I've had that couldn't be answered by google.

The downside is that it is very specialised. It's an object oriented math language, like matlab (only better) or mathematica (but open source and not quite as good). How much that will affect you I can't tell since I've never written an active tradebot, just the algorithms (they've done well, but I didn't power bots with them since they only traded on a week or month scale). Stochastic shows how it's done, though.
donator
Activity: 848
Merit: 1078
April 02, 2012, 08:06:22 PM
#31
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?

R has plenty, and writing a script to plot them all is quite easy. You just have to have the data from mtgox, and you can quickly split it into hi-lo-close and then have functions operate on the data.

You want library(xts),library(quantmod) and library(TTR). TTR has about 35 or 40 technical trading rules, for example easy to vary SMA/EMA.

Then if you want to do bootstrapping you can use (backtesting with variation) you can use library(quantstrat) (i think, this is all from memory).

All of these can be applied within rgp to give you huge flexibility when it comes to evolving GAs. If you do bootstrapping right, you don't have problems with overfitting.

Thanks organofcorti, I'm reading up about it now. I've been programming for a little while but have never heard of R, even for statistical analysis. How come it isnt more mainstream? I've heard of languages such as K and Q which seems to be used fairly widely for banks processing tick by tick data however trading strategies tend to be predominantly done in C.

Do you have an overview of the pros/cons of R, and how it compares to the others. I wanna get a bit more of an idea what the language is like before investing serious time into learning it.

Can it interface easily with PHP and/or the existing API's to automatically place trades?
donator
Activity: 2058
Merit: 1007
Poor impulse control.
April 02, 2012, 01:18:49 AM
#30
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?

R has plenty, and writing a script to plot them all is quite easy. You just have to have the data from mtgox, and you can quickly split it into hi-lo-close and then have functions operate on the data.

You want library(xts),library(quantmod) and library(TTR). TTR has about 35 or 40 technical trading rules, for example easy to vary SMA/EMA.

Then if you want to do bootstrapping you can use (backtesting with variation) you can use library(quantstrat) (i think, this is all from memory).

All of these can be applied within rgp to give you huge flexibility when it comes to evolving GAs. If you do bootstrapping right, you don't have problems with overfitting.
donator
Activity: 848
Merit: 1078
April 01, 2012, 09:41:51 PM
#29
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?
hero member
Activity: 532
Merit: 500
April 01, 2012, 06:51:48 PM
#28
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.

Sure... ideally you want to maintain valid wave counts.  I wish I had the time to build such a wave validity checker and mutator.

a wave counting bot would be soooo cool.
legendary
Activity: 1904
Merit: 1002
April 01, 2012, 02:48:59 PM
#27
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.

Sure... ideally you want to maintain valid wave counts.  I wish I had the time to build such a wave validity checker and mutator.
legendary
Activity: 1190
Merit: 1004
April 01, 2012, 02:36:33 PM
#26
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.
legendary
Activity: 1904
Merit: 1002
April 01, 2012, 02:34:01 PM
#25
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.

This problem is known as overfitting.  The solution is to add noise to the data.  Create 10 copies of the data with random permutations to train it on.

So your solution would be to copy the data and add various noise... how would this noise be added, random changes in the prices? What should the spread and distribution in the randomness be?

I guess using more data and perhaps testing for consistency would help also.

That's the art of it.  I might try something along the lines of scaling similar movements from different timescales to replace the move that actually happened.  This will give the solution space more robustness to handle similar, but slightly different situations.
Pages:
Jump to: