[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A new look at old system.



PureBytes Links

Trading Reference Links

{--------------------------------------------------------
 type    : system
 name    : WFA-WMA
 author  : L. Vercesi, Apr 97
           ik2hlb@xxxxxxxx
 
 simple WMA system (tested on YEN CME weekly data), using 
 Walk Forward Analysis (see R. Pardo book) to choose moving 
 average lookback  from 5 to 50 step 5.
 Performace summary result are, for a time, a sum of
 out-of-sample trading simulation (always using WMA strategy). 

 LenTest=208 means a 4 years optimization period, with a
 forward test period of 2 months.

 [set MaxbarBack>LenTest+60]
 [use on WEEKLY data, EOD only you have a CRAY or more...]

 Absolutely free.
 -------------------------------------------------------------- }

Inputs:LenTest(208);
Vars:CB(0),AccMax(0),Account(0),MP(0),XX(0),LB(0),LBX(0);

CB=CurrentBar;


  If CB/6=IntPortion(CB/6) Or CB=1 Then Begin {when to optimize}

    { optimization of SMA lookback}
    AccMax=-9999999;
    For LB=1 to 10 Begin

      Account=0;
      MP=1;
      For XX=LenTest DownTo 1 Begin

          If MP=1 Then Account=Account+(C[XX]-C[XX+1])*125000;
          If MP=-1 Then Account=Account+(C[XX+1]-C[XX])*125000;

          If MP=-1 And C[XX]>WAverage(H,LB*5)[XX] Then Begin
            MP=1;
            Account=Account-Commission-Slippage;
          End;

          If MP=1 And C[XX]<WAverage(L,LB*5)[XX] Then Begin
            MP=-1;
            Account=Account-Commission-Slippage;
          End;

      End;

      If Account>AccMax Then Begin
        AccMax=Account;
        LBX=LB*5;
      End;

    End;   
   End;  { end optimization loop}


      { and finally the system...}

      If C>WAverage(H,LBX) Then Buy At Close;
      If C<WAverage(L,LBX) Then Sell At Close;
{----------------------------------------------------------------------}


---
Happy trading,

    -Lorenzo Vercesi