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

Oh no- not more code for text on chart



PureBytes Links

Trading Reference Links

I am afraid so. 

With a number of indicators on a chart one can lose track of which
traces go with which indicator. From the color of the value(s)
associated with an indicator name on the status line one can tell which
traces go with which indicator. But only if  the status line is not too
crowded with indicator names or if the indicator at the last bar on
chart has a value. 

To overcome the above possible problems I modified some text code by Bob
Fulks (omgea-list, Sun, 16 Dec 2001 16:46:47 -0500) to color the names
of traces to match the colors of the plots.

Bob's original code printed vertical on the right side of the chart. I
have retained that form and include a horizontal printing.
Included either code in with your indicator code. Does not work in RT
but see http://www.purebytes.com/archives/omega/2002/msg03907.html on
how to make it work in RT.



Vertical Colored Text   {set empty bars to the right side of chart in
TS2K}

			
input:Bars(200);
Vars: ID(0),HH(0),LL(0), Loc(0), Line(0), j(0),x1(0),
    SCo1("");  {String for Condition1 value}      
Array:   StrArr[10]("");   {Output string array}

 if Condition1 then SCo1 = "TRUE" else SCo1 = "FALSE";

if LastBarOnChart then begin
   StrArr[1] = "FastK " ;
   StrArr[2] = "MissingMin ";
   StrArr[3] = "EPS " ;
   StrArr[4] = "MovAvg";
   StrArr[5] = "Cond1= " + Sco1;
  
HH = Highest(High,Bars); {increase Bars if text is crowded}
LL = Lowest(Low, Bars);	 {or decrease if text dissappears}
Line = (HH - LL) / 10;
Loc = HH;
  for j = 1 to 5 begin
    ID=Text_New(Date,Time,Loc-line- j*Line),StrArr[j]);
	If j=1 then value1=Text_SetColor(ID, 2);
	If j=2 then value1=Text_SetColor(ID, 6);
	If j=3 then value1=Text_SetColor(ID, 1);
	If j=4 then value1=Text_SetColor(ID, 12);
	If j=5 then value1=Text_SetColor(ID, 10);
{or if you want to take random colors replace above with
      Value1 = Text_SetColor(ID, ID+1);}
      Value2 = Text_SetStyle(ID, 0, 1);
   end;
end;

=====================================


	{Horizontal Colored Text}

input: Da(30);  {set dates back from r.h.s.}
Vars: ID(0),HH(0),LL(0), Line(0), j(0), x(0), Loc(0),
   SCo1("");{String for Condition1 value} 
Array:   StrArr[10]("");   {Output string array}

if Condition1 then SCo1 = "TRUE" else SCo1 = "FALSE";
if LastBarOnChart then begin
   
   StrArr[1] = "  "+"FastK";   {first printed on chart}
   StrArr[2] = "MissingMin" ;
   StrArr[3] = "   "+"EPS " ; { "   " moves EPS to right}
   StrArr[4] = "   "+"MovAvg " ;
   StrArr[5] = "Cond1=" + Sco1 ;
  
 HH = Highest(High, 200); 
 LL=Lowest(Low, 200);
 Line=(HH-LL)/10;
 Loc=HH;
 plot1(hh +.005*hh); {limits how high the text is printed}
  for j = 1 to 5 begin
    x=j*Da;
    ID=Text_New(Date[x], Time[x], hh-Line, StrArr[j]);
	If j=1 then value1=Text_SetColor(ID, 2);
	If j=2 then value1=Text_SetColor(ID, 6);
 	If j=3 then value1=Text_SetColor(ID, 1);
	If j=4 then value1=Text_SetColor(ID, 12);
	If j=5 then value1=Text_SetColor(ID, 10);
 {or if you want to take random colors replace above with
       Text_SetColor(ID, ID+1);}
      Text_SetStyle(ID, 0, 1);
   end;
end;