| PureBytes Links Trading Reference Links | OK I'm in deep and can't get out .. my 
goal is to  calculate the depth and 
length (may not be for the same pullback)
 of the greatest pullbacks during a move
Here's what I wrote:
If Conti/21 > .75 and Mont<>Month(date) then begin
	TempHi=close[21];
	TempHiday=21;
	Lastevent="UP";
	PBLow=close[21];
	pullbb=0;
	Duration=0;
		For N=0 to 21 begin
				If close[21-N]<TempHi and
Close[20-N]>Temphi[19-N]  then begin
					finalPBLow=close[21-N];
					If close[20-N]> PBLow[1] then
Highday=20-N;
					If close[20-N]> PBLow[1] then
TempHigh=close[20-N];
	
pullbb=(TempHigh-finalPBLow)/AvgTrueRange(20);
		 			finalLowday=21-N;
					If Highday-finalLowday>Duration then
Duration=Highday-finalLowday;
 		 		end;
				If close[21-N]<TempHi and
Close[20-N]<Temphi[19-N]  and (TempHi-close[21-N])/AvgTrueRange(20)>pullbb
then begin
					finalPBLow=close[21-N];
					If close[20-N]> PBLow[1] then
Highday=20-N;
					If close[20-N]> PBLow[1] then
TempHigh=close[20-N];
	
pullbb=(TempHigh-finalPBLow)/AvgTrueRange(20);
		 			finalLowday=21-N;
					startm=Month(Date);
					startd=DayOfMonth(Date);
					If Highday-finalLowday>Duration then
Duration=Highday-finalLowday;
					end;
				If close[21-N]>TempHi  then begin
					TempHi=close[21-N];
					PBLow=close[21-N];
					Lowday=21-N;
				end;
				If N=0 then startm=Month(Date);
				If N=0 then startd=DayOfMonth(Date);
				If N=21 then Endmonth=Month(Date);
				If N=21 then enday=DayOfMonth(Date);
End;
Can anyone see the error?
E-mail message checked by PC Tools Spyware Doctor (5.0.0.184)
Database version: 5.07210
http://www.pctools.com/spyware-doctor/
 |