| View previous topic :: View next topic |
| Author |
Message |
max Guest
Joined: 25 Apr 2005 Posts: 5
|
Posted: Mon Apr 25, 2005 12:47 pm Post subject: Rina |
|
|
I am interested in utilizing as criterion fitness Rina Index
RINA Index = (Net Profit - Net Profit in Outliers)/(Average Drawdown*Percent Time in the Market)
Someone can help myself?
Thanks beforehand by vuestar contribution. A greeting.
Max |
|
| Back to top |
|
 |
DT Developers Team
Joined: 03 Feb 2004 Posts: 188
|
Posted: Wed Apr 27, 2005 11:09 am Post subject: |
|
|
To do this you have to code by hands the following:
1) save
| EasyLanguage: |
|
PositionProfit
|
as array;
2) compute mean and standard deviations of the array;
3) determine outlier as PositionProfit that absolute value is larger then average+3*StdDev of all trades, and add all outliers;
4) code drowdowns and save them as array;
5) compute mean of this array;
6) compute Percent Time in the Market as (TotalBarWinTrade+TotalBarLosTrade)/TotalBars, where TotalBars you have to code too
It is boring and time consuming to code RINA index. IMHO it is shit. You'd better try this one:
| EasyLanguage: |
{******************************************************************* Name: TS.Fitness Analysis Type: Function Description: A fitness function for TSGO Provided By: Trade Smart Research (c) Copyright 2001 - 2005 www.tsresearchgroup.com *******************************************************************} Inputs: InitialEquity(numeric), maxDD(numeric), Period(string); {"D" means Daily; "M" means Monthly, "Q" means Quorterly, "Y" means Yearly} Vars: num(0), PrevEq(1), Equity(0), EqMax(0.0001), DD(0), penalty1(0), penalty2(0), AvgMeasure(0), totalbars(1), RepeatedMeasure(0), PrevRet(1), Return(0), StdMeasure(0), StdErrMeasure(0); Array: measure[9999](0); if barnumber = 1 then PrevEq = InitialEquity; If Period = "D" then condition1 = date <> date[1]; If Period = "W" then condition1 = DayOfWeekFix(Date) < DayOfWeekFix(date[1]); If Period = "M" then condition1 = month(date)<> month(Date[1]); If Period = "Q" then condition1 = (Mod(Month(date),3)=1 or year(date)<>year(date[1])) and Mod(Month(date[1]),3)=0; If Period = "Y" then condition1 = year(date)<>year(date[1]); Equity = InitialEquity + netprofit + openpositionprofit; If condition1 then begin if PrevEq <> 0 then Measure[num] = Equity / prevEq - 1; PrevEq = Equity; num = num + 1; end; if num > 1 {lastbaronchart} then begin AvgMeasure = Average_a(Measure, num); StdMeasure = StdDevS_a(Measure, num); end; RepeatedMeasure = iff(StdMeasure > 0, AvgMeasure/StdMeasure*Squareroot(num), 0); EqMax = maxlist(Equity, EqMax); if EqMax > 0 then DD = 1 - Equity/EqMax; penalty1 = IFF(DD < MaxDD, 0, 100*DD); if lastbaronchart then totalbars=barnumber; if totalbars > 0 then penalty2 = IFF(totaltrades/totalbars < .2, 0, 10*(totaltrades/totalbars-0.2)) + IFF(totaltrades/totalbars > .02, 0, 10*(0.02-totaltrades/totalbars)); TS.Fitness = RepeatedMeasure - penalty1 - penalty2; {***** Copyright (c) 2001-2005 Trade Smart Research, Ltd. All rights reserved. www.tsresearchgroup.com ***** ***** Trade Smart Research reserves the right to modify or overwrite this analysis technique with each release. *****}
|
|
|
| Back to top |
|
 |
max Guest
Joined: 25 Apr 2005 Posts: 5
|
Posted: Thu Apr 28, 2005 4:51 pm Post subject: applying Rina |
|
|
Woooowwww.... Thank you very much by your fast answer.
But I have a problem....
I use easylanguage convert....and I introduce how Fitness criterion the Ts. Fitness, how custom. Once created the code at the time of verifying it, it gives an error me because it says to me that in the field of MaxDD
must go string?????.....
Thanks again for your aid!
A greeting.Max |
|
| Back to top |
|
 |
DT Developers Team
Joined: 03 Feb 2004 Posts: 188
|
Posted: Wed May 04, 2005 11:59 am Post subject: |
|
|
You can use fitness function as input in the code convertor, or put it in the code itself, like this:
| EasyLanguage: |
... {***Initial Strategy code end.***} {***Calculation an optimization criteria.***} Fitness = TS.Fitness(100000, 0.2, "M"); if LastBarOnChart Then Begin {***Save user defined data.***} R = TS.GO.Set("NetProfit",NetProfit); R = TS.GO.Set("MaxIDD",MaxIDDrawDown); R = TS.GO.Set("ProfitFactor",Iff(GrossLoss < 0,-GrossProfit/GrossLoss,0)); R = TS.GO.Set("PercentProfit",PercentProfit); R = TS.GO.Set("TotalTrades",TotalTrades); R = TS.GO.Set("GrossProfit",GrossProfit); R = TS.GO.Set("GrossLoss",GrossLoss); R = TS.GO.Set("LargestLosTrade",LargestLosTrade); R = TS.GO.Set("LargestWinTrade",LargestWinTrade); {***A fitness value is passed to the genetic optimizer on the last bar. If the candidates are included in the current population depends on the result of run.***} R=TS.GO.Fitness(fitness); {***One can look at all tested variants, assigning a print of the gene values for each generation. In PowerEditor in debug window to the debugger.***} {Print(Gen,Fitness,NetProfit);} End;
|
|
|
| Back to top |
|
 |
max Guest
Joined: 25 Apr 2005 Posts: 5
|
Posted: Wed May 04, 2005 3:54 pm Post subject: |
|
|
Thank you!!!! ... DT,.... you are the best!!!
Max |
|
| Back to top |
|
 |
pa-kay Guest
Joined: 10 Aug 2006 Posts: 4
|
Posted: Thu Aug 10, 2006 4:56 am Post subject: |
|
|
I am using TS8, and I don't recognize some of the commands shown in this post. It looks like there is very little difference, but I would appreciate it if someone could either post the code in TS8 syntax, or explain the differences (last resort, I buy a book).
pa-kay |
|
| Back to top |
|
 |
VladGor Support Team
Joined: 26 Jan 2004 Posts: 528
|
Posted: Thu Aug 10, 2006 12:13 pm Post subject: |
|
|
| We would like to clarify about which error you are talking about and if it's possible email us screenshots with this error image. |
|
| Back to top |
|
 |
pa-kay Guest
Joined: 10 Aug 2006 Posts: 4
|
Posted: Sat Aug 12, 2006 3:55 am Post subject: |
|
|
Sorry, not error. I would like to use the fitness function from the post by DT (Posted: Wed Apr 27, 2005 11:09 am), but I think the posted code is not TS8 version code. I would like to know how to convert to TS8.
Thanks,
pa-kay |
|
| Back to top |
|
 |
pa-kay Guest
Joined: 10 Aug 2006 Posts: 4
|
Posted: Sun Aug 13, 2006 5:37 pm Post subject: |
|
|
Okay, I think this is it for TS8. At least it verifies.
| Code: |
{*******************************************************************
Name: TS.Fitness
Analysis Type: Function
Description: A fitness function for TSGO
Provided By: Trade Smart Research (c) Copyright 2001 - 2005
www.tsresearchgroup.com
*******************************************************************}
Inputs: InitialEquity(numeric), maxDD(numeric), Period(string); {"D" means Daily; "M" means Monthly, "Q" means Quarterly, "Y" means Yearly}
Vars: num(0), PrevEq(1), Equity(0), EqMax(0.0001), DD(0), penalty1(0), penalty2(0), AvgMeasure(0), totalbars(1),
RepeatedMeasure(0), PrevRet(1), Return(0), StdMeasure(0), StdErrMeasure(0);
Array: measure[9999](0);
if barnumber = 1 then PrevEq = InitialEquity;
If Period = "D" then condition1 = date <> date[1];
If Period = "W" then condition1 = DayOfWeek(Date) < DayOfWeek(date[1]);
If Period = "M" then condition1 = month(date)<> month(Date[1]);
If Period = "Q" then condition1 = (Mod(Month(date),3)=1 or year(date)<> year(date[1])) and Mod(Month(date[1]),3)=0;
If Period = "Y" then condition1 = year(date)<> year(date[1]);
Equity = InitialEquity + netprofit + openpositionprofit;
If condition1 then begin
if PrevEq <> 0 then Measure[num] = Equity / prevEq - 1;
PrevEq = Equity;
num = num + 1;
end;
if num > 1 {lastbaronchart} then begin
AvgMeasure = Average_a(Measure, num);
StdMeasure = StdDevS_a(Measure, num);
end;
RepeatedMeasure = iff(StdMeasure > 0, AvgMeasure/StdMeasure*Squareroot(num), 0);
EqMax = maxlist(Equity, EqMax);
if EqMax > 0 then DD = 1 - Equity/EqMax;
penalty1 = IFF(DD < MaxDD, 0, 100*DD);
if lastbaronchart then totalbars=barnumber;
if totalbars > 0 then penalty2 = IFF(totaltrades/totalbars < .2, 0, 10*(totaltrades/totalbars-0.2)) + IFF(totaltrades/totalbars > .02, 0, 10*(0.02-totaltrades/totalbars));
TS.Fitness = RepeatedMeasure - penalty1 - penalty2;
{***** Copyright (c) 2001-2005 Trade Smart Research, Ltd. All rights reserved. www.tsresearchgroup.com *****
***** Trade Smart Research reserves the right to modify or overwrite this analysis technique
with each release. *****}
|
|
|
| Back to top |
|
 |
antonio_479 Guest
Joined: 26 Dec 2007 Posts: 4
|
Posted: Sun Jan 20, 2008 10:56 pm Post subject: |
|
|
Developer Team,
What input should be used for Period input with 30 minute bars?
Available settings include: "D" means Daily; "M" means Monthly, "Q" means Quarterly, "Y" means Yearly
Can TS.Fitness function be used with intraday data?
Antonio |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|