Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
wabbit wrote:Whether they "work" to produce profitable trades is another story, and one that will probably take longer than a 30 day trial of MS to resolve. Mehul, Wabbit makes a good point -- it will take you time to learn the ins & outs of MetaStock, even if you were experienced at evaluating trading systems & methods; ie: Money & Risk Management. That said, I can understand your wanting to see what it can do, so here is something quick on Trender: INDICATOR -- Copy & Paste, then drag into main chart window: Code:
{_Test}
Pds:=Input("Period",2,50,10);
Sensitivity:=Input("Std Dev",.5,5,1);
UseClose:=Input("Use Close",0,1,0);
maMP:=mov(mp(),Pds,e);
maATR:=mov(ATR(1),Pds,e);
ADM:=maMP-maATR/2+Stdev(maATR,Pds)*Sensitivity;
Entry:=if(UseClose,Close>ADM,High>ADM);
Exit:=if(UseClose,ADM>Close,ADM>Low);
{ CLEAN - REMOVE REDUNDANT SIGNAL, 1=Buy -1=Sell }
Signal:=Cum(IsDefined(entry+exit))=1; { Enough data ? }
Signal:=ValueWhen(1,entry-exit<>0 OR Signal,entry); { Current }
entry:=Signal*(Alert(Signal=0,2) OR entry*Cum(entry)=1); { Current or 1st }
exit:=(Signal=0)*(Alert(Signal,2) OR exit*Cum(exit)=1); { Current or 1st }
entry:=(exit=0)*entry; { favor EXIT }
Signal:=Entry-Exit; { Signal }
Season:=ValueWhen(1,Signal<>0,Entry)*2-1; { Signal active }
{ PLOT }
ADM;
EXPERT -- Create & Add the following to HIGHLIGHTS: Code:
BUY
---
FmlVar("_Test","Season")=1; { Color -- GREEN }
SELL
----
FmlVar("_Test","Season")=-1; { Color -- RED }
This is what the attached EXPERT looks like on the S&P 500 index: SYSTEM TESTER -- Buy & Sell on next day's OPEN price. Code:
BUY ORDER
---------
dummy:=OPT1;
ref(FmlVar("_Test","Signal"),-1)=+1;
SELL ORDER
----------
ref(FmlVar("_Test","Signal"),-1)=-1;
|