[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"TrendLines-Automatic" code change in TS2000



PureBytes Links

Trading Reference Links

The code for the TS2000 indicator "TrendLines-Automatic" has been
changed from what it is in TS 4, as I just discovered. I find for minute
graphs there may be more (extra?) lines with the TS2000 code than with
the TS 4 code (and the lines may be cleaner on a chart). Also, this TS 4
code generally runs faster. I recommend changing the TS2000 code to what
it is in TS4 as below (with the added new code for plotting on minute
charts).

 This is especially important if "TrendLines-Automatic" is being used on
an indicator as shown in my post "One Indicator Applied On Another
Indicator"  at http://www.traders2traders.com. 


{…. //////…etc…etc…..}

If SwingHighBar(1, High, RHStren, RHStren+1)=RHStren Then Begin
	For Value1 = 9 DownTo 0 Begin
		RHDate[Value1+1] = RHDate[Value1];
		RHTime[Value1+1] = RHTime[Value1];
		RHVal[Value1+1] = RHVal[Value1];
	End;
	  RHDate[0] = Date[RHStren];
	  RHTime[0] = Time[RHStren];
	  RHVal[0] = High[RHStren];

{….. ADD THE CODE BELOW AT THIS PLACE…….}

End;			

If DataCompression >1 then condition1= RHDate[1]<>RHDate[1][1] 
	else condition1=RHTime[1]<>RHTime[1][1];
If condition1 then begin

{….TO HERE….}

	For Value22 = 1 To 10 Begin
		If RHVal[Value22] > RHVal[0] Then Begin
			RHArrayVal = Value22;
			Value22 = 11;
		End;
	End;

	{…………………////………etc………etc..}

If SwingLowBar(1, Low, RLStren, RLStren+1) = RLStren Then Begin
	For Value1 = 9 DownTo 0 Begin
		RLDate[Value1+1] = RLDate[Value1];
		RLTime[Value1+1] = RLTime[Value1];
		RLVal[Value1+1] = RLVal[Value1];
	End;
		RLDate[0] = Date[RLStren];
		RLTime[0] = Time[RLStren];
		RLVal[0] = Low[RLStren];

{….. THEN AGIN ADD CODE BELOW AT THIS POINT …….}

End;

If DataCompression >1 then condition1= RLDate[1]<>RLDate[1][1] 
	else condition1=RLTime[1]<>RLTime[1][1];
If condition1 then begin

{….TO HERE….}


 	For Value22 = 1 To 10 Begin
		If RLVal[Value22] < RLVal[0] Then Begin
			RLArrayVal = Value22;
			Value22 = 11;
			End;
	End;


{    ////….etc….etc…}


wayne mathews