Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 6/8/2005(UTC) Posts: 3 Location: Sydney Australia
|
Got it, understand the date logic now and I am getting a binary wave when I plot it, however I am still struggling how to build it into my ATR Trailing Stop formula, this is what I have;
fmDate:=Input("Start ddmmyy (0=first trade)",0,311299,0);
fmDay:=If(fmDate=0,ValueWhen(1,Cum(1)=1,DayOfMonth()),Int(fmDate/10000));
fmMonth:=If(fmDate=0,ValueWhen(1,Cum(1)=1,Month()),Int((fmDate-fmDay*10000)/100));
fmYear:=If(fmDate=0,ValueWhen(1,Cum(1)=1,Year()),Int(fmDate-Int(fmDate/100)*100));
fmYear:=If(fmYear<100,If(fmYear<40,fmYear+2000,fmYear+1900),fmYear);
fm:=((DayOfMonth()>=fmDay AND Month()=fmMonth AND Year()=fmYear) OR (Month()>fmMonth AND Year()=fmYear) OR Year()>fmYear);
Period:=Input("ATR Average Period",3,100,20);
ATRM:=Input("ATR Multiple",1,10,2.5);
Stop:=C-ATRM*ATR(Period);
If(fm=1,If(L<=PREV,PREV, If(Stop>PREV,Stop,PREV)),0);
It works in that it plots the Trailing Stop from the specified date however with the way I’ve put the formula together it also plots “0” (or whatever number is stated as the False option) prior to the specified date, is there anyway to get it to plot “blank” if not True, in Excel I would use "" but that don’t work in Metastock, I looked through the Formula Primer but still could see how to resolve………………sorry
|