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; 06-26-2008, 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
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Waxavi, Today, 02:10 AM
|
0 responses
4 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
10 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
||
Started by elirion, Today, 01:36 AM
|
0 responses
4 views
0 likes
|
Last Post
by elirion
Today, 01:36 AM
|
||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
0 responses
4 views
0 likes
|
Last Post Today, 01:30 AM |
Comment