Home     News     Software     Order     Download     Support     Publications     Research     Contacts  
   Home

   News

  •  

  • Latest News
      
  •  

  • World News
      
  •  

  • Our achievements
      
       Software

  •  

  • TradeStation Solutions
      
  •  

  • Portfolio Software
      
  •  

  • Genetic Optimization
      
  •  

  • Genetic Optimizer v.2.0 (TSG2)
      
  •  

  • Genetic Optimizer v.1.5 (TSGO)
      
  •  

  • eSignal Solutions
      
  •  

  • Matlab & TradeStation Solutions
      
  •  

  • Excel & TradeStation Solutions
      
       Order

       Download

  •  

  • Free Download
      
  •  

  • Update
      
       Support

  •  

  • Online Help
      
  •  

  • Upgrade Policy
      
       Publications

  •  

  • Fractal dimension – numerical characteristic of trend
      
  •  

  • Volatility Models
      
  •  

  • Genetic optimization. Application in TradeStation environment.
      
  •  

  • Trading Systems Free
      
  •  

  • Money Management
      
       Research

  •  

  • TS Excel Link's using example
      
  •  

  • Strategy Optimization, Curve Fitting and Walk Forward Analysis.
      
  •  

  • Entropy Indicator in TradeStation using Matlab
      
  •  

  • TradeStaion Genetic Optimizer
      
       Contacts

    Overview: Trading System Example

    The system is based on 2 moving average crossover. Buy signal is generated when fast moving average crosses over slow moving average. Additionaly Stop-loss is included in the system. It is very simple system and we don't recomend to trade it but it is very useful to understand the principles of genetic optimization. To do optimization in usual way all parameters will be tested.

    That would include:
    K = TS.GO.Chrom("Buy.Signal");
    R = TS.GO.Gen("Buy.Signal.Len1",K,1,50,1); -- 1 to 50, together 50
    R = TS.GO.Gen("Buy.Signal.Len2",K,1,50,1); -- 1 to 50, together 50

    K = TS.GO.Chrom("Sell.Signal");
    R = TS.GO.Gen("Sell.Signal.Len3",K,1,50,1); -- 1 to 50, together 50
    R = TS.GO.Gen("Sell.Signal.Len4",K,1,50,1); -- 1 to 50, together 50

    K = TS.GO.Chrom("StopLoss");
    R = TS.GO.Gen("StopLoss.SL",K,100,1000,100); -- 100 to 1000, together 11

    All together:
    = 50х50х50х50х11 = 68.75 million tests

    TS GO finds acceptable solution with ~1000 tests. Using our new function FresBlood it's possible to do it even faster, with ~100 to 300 tests.

    It's obvious that using new technological possibilities it's easy to cut down time for searching solutions. New version of Genetic Optimizer for TradeStation v.1.2. supports up to 1000 genes (!), that allows to solve tasks that wouldn't be posible with other methods.

    Example of simple trading system to show the possibilities of Genetic Optimizer for TradeStation.


    EasyLanguage:
     
    {******************************************************************* 
    Name: TS.GO.12.PRO 
    Analysis Type: Strategy 
    Description: Example Strategy for Genetic Optimizer v.1.x 
    Example of simple trading system to show the possibilities of Genetic Optimizer for TradeStation. 
    The system is based on 2 moving average crossover.  
    Buy signal is generated when fast moving average crosses over slow moving average.  
    Additionaly Stop-loss is included in the system. 
    Used: TSGO12.dll 
    Provided By: Trade Smart Research (c) Copyright 2001 - 2004 
             www.tsresearchgroup.com 
    *******************************************************************}
     
     
    Inputs
     Gen(1), {Gen - input parameter, that assigns the number of generations. 
              Optimize in TradeStation with "Start = 1" and "Inc = 1"}
     
     ShowInd(1), {ShowInd - number of individual in population to show} 
     ModeTSGO(0), 
     Population(50), 
     FreshBlood(0), 
     MyReportName("MySystem1"); 
         
     
    { Declaration of variables } 
    Vars: Len1(0),Len2(0),Len3(0),Len4(0),SL(0), 
          Fitness(0),LastRun(0),R(0),K(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 + "(" + GetSymbolName + ").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);  
     
    { Define User variables. } 
     
            R = TS.GO.Var("NetProfit"); 
            R = TS.GO.Var("PF"); 
            R = TS.GO.Var("MaxIDD"); 
     
    {***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("Buy.Signal"); 
            R = TS.GO.Gen("Buy.Signal.Len1",K,1,50,1); 
            R = TS.GO.Gen("Buy.Signal.Len2",K,1,50,1); 
     
            K = TS.GO.Chrom("Sell.Signal"); 
            R = TS.GO.Gen("Sell.Signal.Len3",K,1,50,1); 
            R = TS.GO.Gen("Sell.Signal.Len4",K,1,50,1); 
     
            K = TS.GO.Chrom("StopLoss"); 
            R = TS.GO.Gen("StopLoss.SL",K,100,1000,100); 
             
        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. } 
     
        Len1 = TS.GO.Get("Buy.Signal.Len1",Ind); 
        Len2 = TS.GO.Get("Buy.Signal.Len2",Ind); 
        Len3 = TS.GO.Get("Sell.Signal.Len3",Ind); 
        Len4 = TS.GO.Get("Sell.Signal.Len4",Ind); 
        SL   = TS.GO.Get("StopLoss.SL"  ,Ind); 
        R = TS.GO.ShowViewer
    End
     
    { ---------------------------------------------------------------------- } 
    { The basic strategy code. } 
     
    { Set up the stop-loss parameter. } 
     
    SetStopPosition
    SetStopLoss(SL); 
     
    { The Moving Averages Calculation. } 
     
     
    Value1 = AverageFC(C,Len1); 
    Value2 = AverageFC(C,Len2); 
    Value3 = AverageFC(C,Len3); 
    Value4 = AverageFC(C,Len4); 
     
    { Generation of signals by moving averages crossover. 
      According to the signal, short positions are reversed to long positions and 
      vise versa. Besides, positions can be stopped by stop-loss and 
      trailing-stop orders. }
     
     
    if Value1 cross over  Value2 then Buy This Bar ; 
    if Value3 cross below Value4 then Sell This Bar ; 
     
    { End the basic strategy code. } 
    { ---------------------------------------------------------------------- } 
     
    { Calculation an optimization criteria. The simplest 
      criteria is used here. }
     
     
    R = TS.GO.Stat
     
     
    if LastBarOnChart Then Begin 
     
    { Save user defined data. } 
         
        R = TS.GO.Set("NetProfit",NetProfit); 
        R = TS.GO.Set("PF",Iff(GrossLoss < 0,-GrossProfit/GrossLoss,0)); 
        R = TS.GO.Set("MaxIDD",MaxIDDrawDown); 
     
    { 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. }
     
         
     
        Fitness = TS.GO.Get("%T_Test",0); 
        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,Len1,Len2,Len3,Len4,SL,DT,FA,PC);} 
    end
     
    {***** Copyright (c) 2001-2004 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. *****}
     
     


    <<< List of functions



    Developed by: webdesign.tria.lv  

      About | Privacy Statement | Terms of use | TradeStation Disclaimer

    Copyright © 2004 TS Smart Research

    time: 0.1009 | queries: 3