SQN = N*average(profit)/(stdev(profit)*sqrt(N)) = sqrt(N)*average(profit)/stdev(profit).
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Genetic Optimizer v1.5
Collapse
X

Barbara2,
Yes, you're right. Sorry, I forgot to include that. I guess one reason not to annualize the stdev is that you can't if N = # of trades.
However, N*avg(profit) isn't how you annualize profit either.
Let A = Product(1 + Nj),
Annualized profit((1+A)^(12/N)),
where Nj is the %return for each period and N is # of periods.
I guess that while you wouldn't interpret sqrt(N)*stdev(profit), where N = # of trades, not periods, as a scaled stdev. But, it still stops the variance from exploding which is the point. I.e., we don't want variance(profit)*N, which is why this is calculated as sqrt(variance(profit)*N) = stdev(profit)*sqrt(N).
My main point is still that it makes sense to scale stdev by sqrt but I'm still not getting why SQN users are scaling the mean and not the stdev.
Lou
Comment

The sharpe ratio is usually annualized without compounding.
The sharpe ratio (without the risk free return) for a certain period is:
Sharpe ratio per_period = average(profits_per_period)/stdev(profits_per_period) (arithmetic averages)
The period could be per_day, per_month, per_trade, etc.
To compare and rate the sharpe ratio from different periods, you have to scale the sharpe ratios to a common time period, usually a year.
With N = number of periods (days, months, trades) per year, you get: (no compounding)
 annualized average profits = N*average(profits)
 annualized standard deviation = sqrt(N)*stdev(profits)
 annualized sharpe ratio = N*average(profits)/(sqrt(N)*stdev(profits))
= sqrt(N)*average(profits)/stdev(profits) = sharpe ratio per_year
The SQN in the Genetic Optimizer is the sharpe ratio of the different systems,
scaled from the per_trade period to the optimization_time_period:
the sharpe ratio per_trade for each result is: average(profits_per_trade)/stdev(profits_per_trade)
with N = trades per_optimization_time_period, the sharpe ratio per optimization_time_period is:
sqrt(N)*average(profits_per_trade)/stdev(profits_per_trade) = sqrt(N) * sharpe ratio per_trade = SQN
Now you can compare the optimization results:
a system with the same sharpe ratio per_trade but more trades = higher SQN is usually preferable.Last edited by Barbara2; 06262008, 01:30 PM.
Comment

Barbara2,
I'll take your word for it that this is the reasoning behind the SQN formula. Unfortunately, this logic doesn't fit with the way Sharpe ratios are used or calculated by institutional investors (my background).
Professionally, if I didn't scale the stdev or talked about a sharpe ratio per period it would have been bad news.
Anyway, unless NT does it, I can't imagine free G/O code is going to be improved for different objective functions.
Thanks,
Lou
Comment

Pete,
Giving your nifty optimizer a try here, but ran into a snag. Using version 1.5 and followed directions to copy the two provided files to the Types directory. Recompiled my strategy and then selected optimize as instructed.
When I attempt to run, I get the following error logged:
Failed to call method 'Optimize' for optimizer 'GAOptimizer': Unable to cast object of type 'System.Double' to type 'System.String';
Where did I go wrong?
Comment

Still running into problems here with running this Optimizer. I have found that it will run on SampleMACrossover strategy, but will not run on ANY of the strategies I have written. I have combed through code to compare my strategies to this sample. The only real difference I can find is that my strategies seem to all include a "using NinjaTrader.Gui.Chart;" statement and the SampleMACrossover does not.
Any idea why this is stumbling?
Error message is: Failed to call method 'Optimize' for optimizer 'GAOptimizer': Unable to cast object of type 'System.Double' to type 'System.String'.
Comment

Genetic Optimizer 2.0 for NinjaTrader 6.5
A new enhanced and supported genetic optmizer is referenced in this thread:
http://www.ninjatradersupport2.com/...ad.php?t=17351
Whitmark
Comment
Latest Posts
Collapse
Topics  Statistics  Last Post  

Started by yodaler, Today, 06:12 PM

0 responses
5 views
0 likes

Last Post
by yodaler
Today, 06:12 PM


Started by op1031, Today, 05:16 PM

0 responses
1 view
0 likes

Last Post
by op1031
Today, 05:16 PM


Started by fscabrera03, Today, 01:18 PM

1 response
12 views
0 likes

Last Post
by fscabrera03
Today, 01:18 PM


Started by BottomShark77, Today, 12:20 PM

1 response
11 views
0 likes

Last Post Today, 02:43 PM  
Started by bowling, Today, 06:16 AM

3 responses
30 views
0 likes

Last Post Today, 12:58 PM 
Comment