Bitcoin Forum
June 22, 2024, 11:38:15 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Economy / Speculation / Re: Goomboo's Journal on: December 22, 2013, 03:48:10 PM
For those using php here's a little script I made which generates candle files from bitcoincharts.com (using for example wget http://api.bitcoincharts.com/v1/csv/btceUSD.csv). Alter the $candlesize parameter to set the desired candlesize.
Rename the file you get from bitcoincharts to btc.csv and run the script.

Code:
<?
$handle = fopen('btc.csv',"r");
$candlesize=600;
$i=0;$j=0;
while (($line = fgetcsv($handle,0,",")) != FALSE) {
        $timestamp=$line[0];
        if(!isset($nextstamp)){$nextstamp=$timestamp+$candlesize;}
        $value=round($line[1],4);
        if (($timestamp < $nextstamp)){
                $candle[$i]=$value;
                $i++;$j++;
        }
        else
        {
                if(isset($candle)){
                        $AVG=array_sum($candle)/count($candle);
                        $OPEN=$candle[0];
                        $HIGH=max($candle);
                        $LOW=min($candle);
                        $CLOSE=$candle[$i-1];
                        $TRADES=$i;
                }
                else {
                        $AVG=0;
                }
                print $nextstamp . "," . $OPEN . "," . $HIGH . "," . $LOW . "," . $CLOSE . "," . $TRADES ."\n";
                $i=0;
                $nextstamp=$nextstamp+$candlesize;
                if(isset($candle)){unset($candle);}
        }
}
        fclose($handle);
?>

Output is a csv which can be used for Gekko backtesting.
2  Economy / Speculation / Re: Goomboo's Journal on: December 15, 2013, 01:09:39 PM
Checked for 10/21 and 21/10.
Heatmap. Notice the cells with bold lines around them. Showing calculated profit of 11.2% and 8.1%.


And the Gekko output to verify:

Code:
##### SHORT: 10   LONG: 21 #####
2013-12-15 13:52:18 (INFO):     ADVICE is to SELL @ 728.000 (-10.036)   at      2013-12-07 12:59:57
2013-12-15 13:52:18 (INFO):     ADVICE is to BUY @ 820.000 (0.767)      at      2013-12-09 00:59:58
2013-12-15 13:52:18 (INFO):     ADVICE is to SELL @ 938.000 (-0.661)    at      2013-12-11 14:59:59
2013-12-15 13:52:18 (INFO):     ADVICE is to BUY @ 950.000 (0.591)      at      2013-12-13 05:59:46
2013-12-15 13:52:18 (INFO):     ADVICE is to SELL @ 905.000 (-0.287)    at      2013-12-13 20:59:54

2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) start time:                      2013-12-07 11:59:59
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) end time:                        2013-12-13 22:55:35
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) timespan:                        6 days

2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) start price:                     1065.1
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) end price:                       891
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) Buy and Hold profit:             -16.345883%

2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) amount of trades:                5
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) original simulated balance:      1000.000000 USD
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) current simulated balance:       1081.025961 USD
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) simulated profit:                81.025961 USD (8.102596%)
2013-12-15 13:52:18 (INFO):     (PROFIT REPORT) simulated yearly profit:         4807.540376 USD (480.754038%)

##### SHORT: 21   LONG: 10 #####
2013-12-15 13:54:15 (INFO):     ADVICE is to BUY @ 728.000 (10.036)     at      2013-12-07 12:59:57
2013-12-15 13:54:15 (INFO):     ADVICE is to SELL @ 820.000 (-0.767)    at      2013-12-09 00:59:58
2013-12-15 13:54:15 (INFO):     ADVICE is to BUY @ 938.000 (0.661)      at      2013-12-11 14:59:59
2013-12-15 13:54:15 (INFO):     ADVICE is to SELL @ 950.000 (-0.591)    at      2013-12-13 05:59:46
2013-12-15 13:54:15 (INFO):     ADVICE is to BUY @ 905.000 (0.287)      at      2013-12-13 20:59:54

2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) start time:                      2013-12-07 11:59:59
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) end time:                        2013-12-13 22:55:35
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) timespan:                        6 days

2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) start price:                     1065.1
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) end price:                       891
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) Buy and Hold profit:             -16.345883%

2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) amount of trades:                5
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) original simulated balance:      1000.000000 USD
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) current simulated balance:       1111.949512 USD
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) simulated profit:                111.949512 USD (11.194951%)
2013-12-15 13:54:15 (INFO):     (PROFIT REPORT) simulated yearly profit:         6642.337697 USD (664.233770%)

And Queeg/Bulbasur you're right! It swaps the BUY/SELL moments as you can see above, effectively trading against the crossovers. Resulting in higher profits in the specific market dynamics of the specified time period. I'll be running some tests on other data sets (varying from/to and interval) to see how this holds against other periods. Might be interesting to see the results...
3  Economy / Speculation / Re: Goomboo's Journal on: December 15, 2013, 12:41:25 PM
I'm checking my scripts very carefully now, just to make sure that there are no mistakes in it. But basically what it does is looping over the gekko config file altering those parameters:
Code:
  // EMA weight (α)
  // the higher the weight, the more smooth (and delayed) the line
  short: 10,
  long: 21,
  // amount of candles to remember and base initial EMAs on

4  Economy / Speculation / Re: Goomboo's Journal on: December 14, 2013, 12:56:42 PM
That's interesting. I'm using Whydifficults Gekko trading bot which can be found at:

https://bitcointalk.org/index.php?topic=209149.0

(which is by the way pretty amazing stuff!)

Basically it lets you set the EMA pair and some thresholds. Input is a csv file with timestamp, open, high, low and close values. But i assume it does roughly the same as your exponential algorithm.

While making a php script to loop over various settings of Gekko I noticed that there are some very profitable results when you take the short average with a higher setting compared to the long average. That would be in your graphs any values below the diagonal line (which is in your graph blanked out).
Might be interesting to modify your script to see what is shown in this now white area.

Below is the candle-file which I used to make this graph:

http://www.canalphotos.nl/gekko/upload/candles.csv
5  Economy / Speculation / Re: Goomboo's Journal on: December 14, 2013, 11:10:50 AM
See below. Notice especially the area with the short between 41-43 and the long around 25.



And a sample run of Gekko on the EMA pair short 42, long 25:

Code:
2013-12-14 12:09:10 (INFO):     ADVICE is to BUY @ 728.000 (7.710)      at      2013-12-07 12:59:57
2013-12-14 12:09:10 (INFO):     ADVICE is to SELL @ 962.900 (-0.511)    at      2013-12-09 09:59:59
2013-12-14 12:09:10 (INFO):     ADVICE is to BUY @ 908.610 (0.330)      at      2013-12-12 04:59:59
2013-12-14 12:09:10 (INFO):     ADVICE is to SELL @ 972.010 (-0.255)    at      2013-12-13 11:59:54


2013-12-14 12:09:10 (INFO):             WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2013-12-14 12:09:10 (INFO):             WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!


2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) start time:                      2013-12-07 11:59:59
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) end time:                        2013-12-13 22:55:35
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) timespan:                        6 days

2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) start price:                     1065.1
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) end price:                       891
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) Buy and Hold profit:             -16.345883%

2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) amount of trades:                4
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) original simulated balance:      1000.000000 USD
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) current simulated balance:       1403.670563 USD
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) simulated profit:                403.670563 USD (40.367056%)
2013-12-14 12:09:10 (INFO):     (PROFIT REPORT) simulated yearly profit:         23951.120080 USD (2395.112008%)
6  Economy / Speculation / Re: Goomboo's Journal on: December 14, 2013, 10:23:19 AM
Very interesting stuff Goomboo. Respect.
I've been running soms backtests using Gekko from Whydifficult (again many respect).

What I've done is creating a script which alters the ema pair in the config file and loops Gekko over this. I'm on my phone now so can't upload the results. Quite similar to queeq, but haven't read his post while making the script...

A very interesting outcome is that the ema pairs which have a short period bigger than the long gives very consistent high profit percentages. Way higher than the other way around. Also looking at the buy sell moments it tends to buy low and sell high pretty good.

data period is last 1.5 weeks and interval is 1h.

Any insights on this?

I will upload files when on laptop.
7  Other / Beginners & Help / Re: Whats the cheapest bitcoin you got? on: November 16, 2013, 04:43:25 PM
Couple of coins when they were around $3. Never looked at them till they hit $80. Sold then, and never looked at BTC. Still one coin on bitcoin-24.com which I can't seem to get off. Now starting to buy again. Not for trading, but with the intention to keep them for some years and see what happens then...
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!