Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
Code:
Pds:=Input("Period",OPT1,OPT2,OPT3);
Sensitivity:=Input("Std Dev",.OPT4,OPT5,OPT6);
UseClose:=Input("Use Close",0,1,0);
Should be
Pds:=Opt1;
Sensitivity:=Opt2;
UseClose:=Opt3;
Opt1 min should be 5 Max should be 50 and steps should be 5
Opt2 min should be 1 and Max should be 5 and steps should be 1
Opt3 Min should be 0 and max should be 1 and steps should be 1
under the long enrty
Pds:=Opt1;
Sensitivity:=Opt2;
UseClose:=Opt3;
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 }
Season=1 and Ref(Season,-1)<>1
Under the sell order tab
Pds:=Opt1;
Sensitivity:=Opt2;
UseClose:=Opt3;
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 }
Season<>1 and Ref(Season,-1)=1
under the sell short order tab
Pds:=Opt1;
Sensitivity:=Opt2;
UseClose:=Opt3;
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 }
Season=-1 and Ref(Season,-1)<>-1
in the buy to cover tab
Pds:=Opt1;
Sensitivity:=Opt2;
UseClose:=Opt3;
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 }
Season<>-1 and Ref(Season,-1)=-1
this is an example of a system that gives 4 distinct signals. with this code you could use it in experts ,explorations and now system tests
|