PureBytes Links
Trading Reference Links
|
------------------------------------------------------------------------
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group.
To reply: http://groups.yahoo.com/group/equismetastock/post?act=reply&messageNum=5587
------------------------------------------------------------------------
Bob
> I have one more question. I want to enter the start date
> and stop date for these lines when I first initiate this
> new indicator. How can I parse an input string of:
>
> mmddyyyy
>
> into three variables?
This is "a can of worms". There are a number of MS issues that make this
difficult to do, and I'm sure you'll hit most of them while trying.
The approach I would take is to start the 8 digits as above and
progressively use the Int() and Frac() functions to eliminate the unwanted
numbers. Once you have done that you may need to imbed each value within
LastValue() so that it can be used by other functions as a constant. It will
depend on what following functions need access to the split date. Frac() can
cause tiny fractional errors that, for example, leave you with values of
14.999998 or 15.000001 rather than 15, so you need to take precautions
against this. Floor() and Ceiling() are also functions that can cause
similar problems.
Following is the user input section of my 'Trade Stop LE' indicator.
Hopefully you can see how I've gone about splitting one value into three.
'Cp' into 'Cp', 'Nd' and 'Xd' (capital, entry and exit delays) is one of the
splits performed.
On second thoughts I've included the entire indicator so you have something
that you can play with that actually works. as a whole or can be
experimented with just to try different ways of splitting the Input()'s.
Roy
{Trade Stop LE} {V3.5}
No:=Input("Entry / Exit Prices 1=O 2=C 3=H 4=L 5=Stop ##",11,55,22);
Cp:=Input("Capital, Entry / Exit Delays $ ## ",0,100033,10011);
Cm:=Input("Entry / Exit Costs $$",0,9999,2020);
Pt:=Input("Profit / Loss Targets, 99 to Disable %%",0,9999,2510);
Xa:=Input("+++ See Below for Stop Trigger and Price +++",0,0,0);
Xa:=Input("1=C/Next-O 2=C/C 3=Stop/C 4=Stop/Stop ##" ,11,44,44);
N:= Cross(Mov(C,20,E),Mov(C,30,E));
Ns:=0;
X:= 0;
Xs:=0;
{** end or user area **}
Xo:=No-10*Int(No/10);No:=Int(No/10);
Xc:=Xa-10*Int(Xa/10);Xa:=Int(Xa/10);
Nd:=LastValue(Int(0.1+Frac(Cp/100)*10));
Xd:=LastValue(Cp-Int(Cp/10)*10);
Cx:=Cm-100*Int(Cm/100);Cm:=Int(Cm/100);Cp:=Int(Cp/100)*100;
Ls:=Frac(Pt/100);Pt:=Int(Pt/100)/100;
N:=N AND Alert(N=0,2);X:=X AND Alert(X=0,2);
N:=If(Nd=0,N,Alert(N,Nd+1) AND Alert(N,Nd)=0);
N:=If(N>0,If(No=1,O,If(No=3,H,If(No=4,L,C))),0);
N:=If(No=5,If(Ns>0,Max(L,Ns),0),N);
X:=If(Xd=0,X,Alert(X,Xd+1) AND Alert(X,Xd)=0);
X:=If(X>0,If(Xo=1,O,If(Xo=3,H,If(Xo=4,L,C))),0);
X:=If(Xs>0 AND Xo=5,Max(L,Xs),X);
Pf:=(Cp*(1+Pt)+Cx)/(Cp-Cm);
Lf:=Min(1,(Cp*(1-Ls)+Cx)/(Cp-Cm));
Tr:=If(PREV=0,If(N>0 AND X=0 AND (No=2 OR
(If(Xa<3,C,H)<Pf*N AND If(Xc<3,C,L)>Lf*N)),N,0), If(X>0 OR
(If(Xa<3,C,H)>=Pf*PREV AND Pt<>.99) OR
(If(Xc<3,C,L)<=Lf*PREV AND Ls<>.99),0,PREV));
Tr:=If(Alert(Tr>0,2)=0 AND N>0 AND
(((If(Xa<3,C,H)>=Pf*N OR If(Xc<3,C,L)<=Lf*N)
AND No<>2) OR (X>0 AND Nd+Xd<1 AND No<>2 AND
Xo>1 AND (Max(No,Xo)>4 OR No<>Xo))),-N,Tr);
Xb:=(Tr=0 AND Alert(Tr>0,2)) OR (Tr<0 AND Alert(Tr=0,2));
Cx:=ValueWhen(1,Cum((N+Ns+X+Xs)>-1)=1 OR Tr<>0,Abs(Tr));
Cp:=If(Xb,If(Xa<3 AND C>=Cx*Pf,C,If(Xa>2 AND H>=Cx*Pf,Cx*Pf,0)),0);
Cp:=If(Cp>0,If(Cp>=.5,PREC(Cp,2),If(Cp<.1,PREC(Cp,3),PREC(Cp*2,2)/2)),0);
Cp:=If(Xa=4 AND Cp>0,If(Tr<0,Cp,Max(O,Cp)),Cp);
Cp:=If((Xa=2 OR Xa=3) AND Cp>0,C,If(Xa=1 AND Xo<5,Ref(Cp,-1),Cp));
Cp:=If(Xa=1 AND Cp>0 AND Xo<5,O,Cp);
Cm:=If(Xb,If(Xc<3 AND C<=Cx*Lf,C,If(Xc>2 AND L<=Cx*Lf,Cx*Lf,0)),0);
Cm:=If(Cm>0,If(Cm>=.5,PREC(Cm,2),If(Cm<.1,PREC(Cm,3),PREC(Cm*2,2)/2)),0);
Cm:=If(Xc=4 AND Cm>0,Max(L,Min(If(Tr<0,H,O),Cm)),Cm);
Cm:=If((Xc=2 OR Xc=3) AND Cm>0,C,If(Xc=1 AND Xo<5,Ref(Cm,-1),Cm));
Cm:=If(Xc=1 AND Cm>0 AND Xo<5,O,Cm);
Cx*Alert(Tr<>0,2); Cx*Pf*Alert(Tr<>0,2); Cx*Lf*Alert(Tr<>0,2);
If(Cm>0,Cm,If(Cp>0,Cp,If(Xs>0 AND Xo=5,X,0)));
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|