VST (custom ver.) "Milk Money Trade" strategy test

This post contains the MetaStock code for the "Milk Money Trade" strategy.

The "VSTPro" test results are towards the end of the post.

The next post will display charts with added text on using the VST (custom ver.) template to chart the Milk Money Trade stratey.


{Milk Money Trade strategy.

http://www.thinkmoney-digital.com/thinkmoney/2010springred#pg30

Coded by Jose Silva at
http://www.metastocktools.com }

{User Inputs}
pds1:=Input("EMA periods",1,260,20);
shift:=Input("EMA Envelope shift %",0,20,4);
pds2:=Input("Awesome Oscillator pds1",1,260,5);
pds3:=Input("Awesome Oscillator pds2",2,260,21);
plot:=Input("[1]Long [2]Short [3]MAE [4]Awesome Osc",1,4,1);

{EMA}
EMA:=Mov(C,pds1,E);

{MAE bands}
upper:=EMA*(1+shift/100);
lower:=EMA*(1-shift/100);

{Awesome Oscillator}
AO:=Mov(MP(),pds2,S)-Mov(MP(),pds3,S);
up:=AO>Ref(AO,-1);
dw:=AO0 OR init,entry);

{Signals Long}
entry:=up*setup;
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
entry:=bin
*(Alert(bin=0,2) OR entry*Cum(entry)=1);
exit:=(bin=0)*(Cum(bin)>0)*Alert(bin,2);
long:=entry-exit;

{Setup Short}
entry:=Cross(H,upper);
exit:=Cross(EMA,L);
init:=Cum(IsDefined(entry+exit))=1;
setup:=ValueWhen(1,entry-exit<>0 OR init,entry);

{Signals Short}
entry:=dw*setup;
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
entry:=bin
*(Alert(bin=0,2) OR entry*Cum(entry)=1);
exit:=(bin=0)*(Cum(bin)>0)*Alert(bin,2);
short:=entry-exit;

{Display}
If(plot=3,upper,0);
If(plot=3,EMA,If(plot=4,AO*up,0));
If(plot=1,long,If(plot=2,short,
If(plot=3,lower,AO*dw)))

---8<----------------------------------------


Backtest results using the VSTpro:

----------------------------------------------------------

Milk Money Trade Long - S&P500 stocks, 12 years' EOD data

P/Rratio 0.5
Tprofit% 23.55
MaxRisk% 53.75
Win% 62.5
Leverage 0.6
PosSize% 55.85
W/Lratio 0.8
Avg Prds 10.3
T trade% 18.45
Tprofit% 7.3
T loss% 11.25


Milk Money Trade Short - S&P500 stocks, 12 years' EOD data

P/Rratio 0
Tprofit% -15.85
MaxRisk% 62.4
Win% 58.3
Leverage 0.5
PosSize% 48.1
W/Lratio 0.6
Avg Prds 10.7
T trade% 23
Tprofit% 7.7
T loss% 15.1

----------------------------------------------------------

No comments:

Post a Comment

 
Design Credit Best Blogger Tips | Best Blogger Templates | Best Social Icons