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

Re:Oh no- not more code for text on chart



PureBytes Links

Trading Reference Links

The first version of this code was written with only TS2K in mind and
now appears on http://www.traderstotraders.com . I did not put it on
traderstotraders so whom ever did, maybe they will replace it with the
versions below, which work in both TS2K and TS 4. There are requests for
it to work in TS 4.

The inputs for this type code always need adjusting. If TS had a "Bar
Spacing" function it could be used to keep the text fixed as the bar
spacing is changed (since bar spacing is indicated in "Format Chart
Window, properties" it would seem easy enough to make it available as a
function). 



> 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}

input: ver(100), horiz(40); {in TS2K set ver to 0 and use empty 
        bars to the right side of chart in}
Vars: ID(0),HH(0),LL(0), Loc(0), spacing(0), j(0),x1(0),
    SCo1("");  {String for Condition1 value}      
Array:   StrArr[10]("");   {Output string array}

{ your code goes here e.g. }
 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,ver); 
LL = Lowest(Low, ver);  
spacing = (HH - LL) / 10;  {increase spacing if text is crowded}
for j = 1 to 5 begin
  ID=Text_New(Date[horiz], Time[horiz],HH - j*spacing,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;
if 2=3 then plot1(c,"");


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

        {Horizontal Colored Text}

input: horiz(30), ver(300); {sets  back from r.h.s. and top; }
Vars: ID(0),HH(0),LL(0), Line(0), j(0), x(0), ver2(0),
   SCo1("");   {String for Condition1 value} 
Array:   StrArr[10]("");   {Output string array}

{ your code goes here, e.g. }
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, ver); 
 LL=Lowest(Low, ver);
 ver2=(HH-LL)/10;   {use if plot1 is not used}
plot1(HH +.005*hh,""); {limits how high the text is printed.
 you can comment out this plot1 and just use ver2 below,
 which is now commented out.}
  for j = 1 to 5 begin
    x=j*horiz;
    ID=Text_New(Date[x],Time[x], HH {-ver2} ,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;
if 2=3 then plot1(C,"");