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

Trendline help...



PureBytes Links

Trading Reference Links

Hello All,

I borrowed this code from TSWorld. It draws horizontal trendlines on the
chart using a "For" loop and and ARRAY.

It was originally used for the daytrader pivots based on prior days OHLC
with a text object set at the beginning of the day.  I modified the code so
that I could set the individual price levels. But one thing I would like to
change is the text object. I would like it to update at the END of the
trendline on each bar.

Below is the code for the trendline/text array. Any help on how to modify it
so the text object updates at the end of the trendline would be greatly
appreciated. I must honestly say that I am not advanced enough to understand
how this is working, but I was able to modify the calculations for my own
price levels. 

Thanks in advance,
JTraDer421

If     DataCompression < 2       { intraday or tick bars }
   and Date >= BeginDate and Date <= EndDate then begin
      if Date = Date[ 1 ] then begin { other bars in day }
         For ii = pl1  to wl10 begin
            TL_SetEnd( LineID[ ii ], Date, Time, SRValue[ ii ] ) ;
         end; { for }
      end { if Date = Date[ 1 ] }
      else Begin                   { first bar in day }
         
       	{Price level Calculations}

         For ii = pl1 to wl10 Begin  {PL1:WL10 are part of my level
calculations}

            { creates lines }
            LineID[ ii ] = TL_New(Date,Time,SRValue[ ii ],Date,Time,SRValue[
ii ]);
            TL_SetExtLeft (LineID[ ii ],ExtLeft);
            TL_SetExtRight(LineID[ ii ],ExtRight);
            TL_SetColor(LineID[ ii ],StandardColor);
            	
  
            If ii > 0 and ii < 10 then 
               TL_SetStyle(LineID[ ii ],Tool_dotted);
         	If ii > 11 then 
               TL_SetStyle(LineID[ ii ],Tool_Solid);

		{ create text labels }
		TextID[ ii ] = Text_New(Date,Time,SRValue[ ii ],TextLabel[
ii ]);
		Text_SetStyle(TextID[ ii ],1,1); 	
		Text_SetColor(TextID[ ii ],StandardColor);
	end
	else begin
            Text_SetLocation(TextID[ii],date,Time,SRValue [ii]);
		
		

   	end; { for }
      end; { else }
   end;
end;