TradeStation converted Signals for Genetic Optimizer: Volatility Short Exit
Original:
| EasyLanguage: | {******************************************************************* Description : Volatility Short Exit Provided By : Omega Research, Inc. (c) Copyright 1999 ********************************************************************} Inputs: VtyPercent(1.5); ExitShort ("Vty") Next Bar at Close + (VtyPercent * AvgTrueRange(5)) Stop;
|
Converted:
| EasyLanguage: | {******************************************************************* EasyLanguage Code Converter for Genetic Optimizer Template: Basic with comments. Analysis Type: Strategy Description: Code is generated automatically Date/Time:10.26.2004 23:54:22 Used: TSGO12.dll Provided By: Trade Smart Research www.tsresearchgroup.com *******************************************************************} {***Start All Code***} {***Declaration of inputs***} Inputs: Gen(1), {Optimize in TradeStation with "Start = 1" and "Inc = 1"} ShowInd(1), ModeTSGO(0), Population(50), FreshBlood(0), MyReportName("MySystem1"); Input: Fitness(NetProfit); {***Declaration of variables***} Vars: VtyPercent(1.5); Vars: R(0),K(0),LastRun(0),Ind(0); {***The Genetic Optimizer initialization and the definition of genes***} If CurrentBar = 1 Then Begin {***This block runs on every run of strategy on the first bar. The function TS.GO.Start is called having the Parameter that defines filename for milestones. All the tunings of an optimizer and current population are stored in the file, that allows to continue an optimization after break, or to draw the input/output signals after the opening the TradeStation workspace with the strategy. It is possible to open this file in graphic interface for viewing population.***} R = TS.GO.Start(MyReportName + ".rgo"); {***This block runs when the optimization is starting for the first bar only.***} If Gen=1 Then Begin {***The initializing of optimizer determination of genes and the population regime is executed (see the description of functions). We start optimizer with empty population in a given example.***} R=TS.GO.Mode(ModeTSGO); R=TS.GO.Popul(Population); R=TS.GO.FreshBlood(FreshBlood); {***Sets up new chromosomes and new genes. Chromosome Parameters: TS.GO.Chrom(Name) Name – name of chromosome. Gene Parameters: TS.GO.Gen(Name,Chrom,Min,Max,Incr) Name – name of gene. Chrom – number of chromosome that contains gene (if 0 then gene doesn’t participate in mutations, it’s fixed). Min – minimal value of gene. Max – maximal value of gene. Incr – value increase (step), if = 0 then any values in set range can be used.***} K=TS.GO.Chrom("Chrom1"); R=TS.GO.Gen("Chrom1.VtyPercent",K,0.1,1.5,0.1); {***Define User Performance Criteria.***} R = TS.GO.Var("NetProfit"); R = TS.GO.Var("MaxIDD"); R = TS.GO.Var("ProfitFactor"); R = TS.GO.Var("PercentProfit"); R = TS.GO.Var("TotalTrades"); R = TS.GO.Var("GrossProfit"); R = TS.GO.Var("GrossLoss"); R = TS.GO.Var("LargestLosTrade"); R = TS.GO.Var("LargestWinTrade"); End; {**The generation of a new candidate in the population**} LastRun = TS.GO.Next(Gen); {***If this is the last path, shows results for Ind = ShowInd; Else get the next candidate Ind = 0;***} Ind = Iff(LastRun = 1,ShowInd,0); {***Get values of genes for choosen candidate.***} VtyPercent = TS.GO.Get("Chrom1.VtyPercent",Ind); R = TS.GO.ShowViewer; End; {***Initial Strategy code begin.***} {******************************************************************* Description : Volatility Short Exit Provided By : Omega Research, Inc. (c) Copyright 1999 ********************************************************************} ExitShort ("Vty") Next Bar at Close + (VtyPercent * AvgTrueRange(5)) Stop; {***Initial Strategy code end.***} {***Calculation an optimization criteria.***} 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; {***End All Code***}
|
|