The Financial Hacker

Posted By: jcl

The Financial Hacker - 09/08/15 13:14

I've started a new blog on http://www.financial-hacker.com. We're often doing experiments with trade systems for Zorro, and I'm going to publish the results on this blog, as well as some of my other experiences in the realm of algorithmic trading. All code and scripts will be published as well.
Posted By: MatPed

Re: The Financial Hacker - 09/08/15 14:00

I have read the articles. Good Job man!
Posted By: boatman

Re: The Financial Hacker - 09/08/15 15:31

Fantastic articles jcl. You gave me some more ideas. And its also very helpful to follow your application of the scientific method to trading research. Looking forward to the next article about White's reality check. Thanks for sharing.
Posted By: forexcoder

Re: The Financial Hacker - 09/08/15 18:40

Jcl thanks very much!!! Great work by a great man!!
Posted By: DdlV

Re: The Financial Hacker - 09/09/15 22:02

+1! Thanks for helping us learn more & hopefully faster! laugh
Posted By: 4xBones

Re: The Financial Hacker - 09/11/15 02:51

Thanks jcl, much appreciated. smile
Posted By: Sphin

Re: The Financial Hacker - 09/11/15 17:45

Code:
int Periods[10] = { 10,20,50,100,200,500,1000,2000,5000,10000 };
int Period = Periods[optimize(1,1,10,1)-1];


Cool example how to optimize a self-made scale, should be added under 'Tips & Tricks'.
Posted By: Toronado

Re: The Financial Hacker - 09/14/15 14:34

Really like the posts on your financial hacker blog so far. Thanks for those laugh
Posted By: royal

Re: The Financial Hacker - 10/27/15 14:27

Hey jcl!
One question concerning the cold blood index. Do you have an example how to create the BalanceDaily.dbl in a strategy script?
Posted By: jcl

Re: The Financial Hacker - 10/27/15 16:11

if(hour(1) > hour(0))
file_append("Log\\BalanceDaily.dbl",&Balance,sizeof(var));

I'm not sure if the release version accepts a size parameter for file_append - maybe you need the beta version.
Posted By: boatman

Re: The Financial Hacker - 10/28/15 02:05

jcl, love your post about the Cold Blood Index. I posted a comment there, but will post it here for the Zorro community as well. Let me know if you'd prefer future comments to be posted to the financial hacker site only.

My comment:

Great post and thank you for sharing. I was looking for a solution like this recently in order to objectively decide when to pull out of a strategy. I settled on a modification of your second example, where an allowance is made for the drawdown to grow with time. The modification I made was to use the confidence intervals for the maximum drawdown calculated by Zorro’s Monte Carlo engine rather than the maximum drawdown of the backtest. The limitation is that we don’t know the confidence intervals for the maximum drawdown length – only the maximum drawdown depth. I used the maximum drawdown length calculated for the backtest and considered where the backtest drawdown depth lay in relation to the confidence intervals calculated via Monte Carlo to get a feel for whether it was a reasonable value.

I like your Cold Blood Index a lot. It is more meaningful than the approach I used, but it does suffer from a similar drawback – that is, being a function of the balance curve in the backtest. If you accept that the balance curve obtained in the backtest is one possible outcome amongst an infinite number of possibilities due to the random nature of individual trade results, then the result obtained with the Cold Blood Index is likewise one possible outcome amongst many.

(As an aside, this condition can be validated by examining the autocorrelation of the backtest returns series with various lags using either Zorro, R or some other statistical tool. Nearly every strategy I’ve experimented with, and definitely the few that I’ve taken live, have all shown statistically insignificant return autocorrelations).

I think your (fantastic) idea of the Cold Blood Index could be improved by incorporating the algorithm into a Monte Carlo routine that creates many unique balance curves by randomly sampling the backtested trade results, and running it separately on each curve. Obviously the computation time would become significant, so the additional effort would only be worth it having confirmed that the returns series exhibits statistically insignificant autocorrelation.

Is this something that would be possible with Zorro, or do you think it would be a more efficient use of time to attempt it directly within R?

Thanks for sharing your research. I learn a lot from every post.
Posted By: royal

Re: The Financial Hacker - 10/29/15 10:10

Yes, works with the beta version. Thanks! laugh
Posted By: nanotir

Re: The Financial Hacker - 03/21/16 19:10

The link sent in the last email does not work
http://www.financial-hacker.com/build-better-strategies-part-4-data-mining
Posted By: madpower2000

Re: The Financial Hacker - 09/11/16 16:23

Trying to reproduce results from last article:

http://www.financial-hacker.com/build-better-strategies-part-5-developing-a-machine-learning-system/

But my equity curve and result are different:

http://imgur.com/a/xRrf0

Any suggestion what did I miss??
Posted By: dr_panther

Re: The Financial Hacker - 10/24/16 20:29

I found a very interesting technique to multiply trade variations on your blog, but I don't get it right, please can you tell me, what I am doing wrongly.

My expectation based on the bog would be to get print 10, 20, 50...
but what I actually get is just 10.


Code:
function run()
{
	StartDate=20160104;
	StartDate=20160105;
	int Period;
	int Periods[10] = { 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000 };
		
	while(asset(loop("EUR/USD" )))
  	{
    	Period = Periods[optimize(1,1,10,1)-1];
	printf("Period: %02d, ",Period) ;
	}
}

Posted By: jcl

Re: The Financial Hacker - 10/25/16 16:02

I believe messages are suppressed in training - use print(TO_ANY) for printing in training mode.
Posted By: dr_panther

Re: The Financial Hacker - 10/26/16 10:52

Sorry, if my questions about that are ignorant, but after many hours of testing, I still don't understand the output.

My understanding is that the optimize function should generate multiple outputs similar to this code:


Code:
function run()
{
	set(PARAMETERS|LOGFILE);
	StartDate=20160106;
	EndDate=20160107;
	BarPeriod = 1440;
	LookBack =0;
	int Period;
	int Periods[10] = { 10, 20, 50 };
	int i;	
	while(asset(loop("EUR/USD" )))
	for (i=0;i<3;i++)
  	{
    	Period = Periods[i]; //
    	print(TO_ANY,"Period: %d, ",Period) ;
		
	}
}



When I press "Trade", the log file looks like that

Code:
[1: Thu 07.01.16 00:00] (1.07497)Period: 10, Period: 20, Period: 50,



however the following code :
Code:
function run()
{
	set(PARAMETERS|LOGFILE);
	StartDate=20160106;
	EndDate=20160107;
	BarPeriod = 1440;
	LookBack = 0;
 	int Periods[10] = { 10, 20, 50 };
 
	while(asset(loop("EUR/USD" )))
  	{
    	int Period = Periods[optimize(1,1,3,1)-1];  
    	print(TO_ANY,"Period: %d, ",Period) ;
	}
}



generates:

Code:
[1: Thu 07.01.16 00:00] (1.07497)Period: 10,




I wonder how the optimize function can be used to create multiple variations of the trends. Additionally I would like to know if the optimize function is comparable with the for loop.

Thanks for you patients, jcl :))
© 2024 lite-C Forums