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

Re: Debugging TS4 Text-on-Chart Code



PureBytes Links

Trading Reference Links

It is not clear what you are trying to do but it looks as if you want
to draw the text at the first bar of each day session.

If that is the case you need not wait until the LastBarOnChart to
draw it. Why not the following:

Var: OpHi(0),
  OpLo(0),
  ID1(0),
  ID2(0);

IF T = Sess1StartTime + BarInterval THEN BEGIN
  OpHi = H;
  OpLo = L;
  ID1 = Text_New(Date,Time,OpHi+2,NumToStr(OpHi,2));
  Value1 = Text_SetColor(ID1,Tool_White);
  Value2 = Text_SetStyle(ID1,1,0);
  ID2 = Text_New(Date,Time,OpLo-2,NumToStr(OpLo,2));
  Value1 = Text_SetColor(ID2,Tool_White);
  Value2 = Text_SetStyle(ID2,1,1);
END ELSE BEGIN
  OpHi = OpHi[1];
  OpLo = OpLo[1];
END;

Plot1(0,"");


At 2:37 PM -0400 4/22/02, TaoOfDow wrote:

>Dear Group,
>
>I've been playing around with the text-writing code Bob Fulks posted
>here a couple of weeks ago; see Re: Printing Text Above Price, April 5.
>
>The following code writes the numeric value of the H and the L of the
>opening bar (on a minute-based chart) to the left of that bar.
>
>On the one hand, it works, more or less.
>
>On the other hand, it only works until the chart (in realtime) begins to
>post the prices for the next bar, and then the foregoing numeric values
>disappear.  (Clarification: "the next bar" meaning the next bar after
>the bar when the study was added to the chart.)
>
>Observations So Far:
>1.  If I click into Format Analysis Techniques > Status and then turn
>the study off and then back on, the study will reappear until the then
>next bar.
>2.  I've tried formatting the study with Update Every Tick both On and
>Off, but I get the disappearance with both settings.
>3.  I also notice that after the disappearance, if I click Refresh
>Screen (namely, the square button on the right of the Scroll Bar), I get
>the numeric values for an instant, but only for an instant --- so
>they're there, but just not writing to the screen.
>
>Query:  How do I get the study to show in perpetuity?
>
>Sincerely,
>
>Richard
>
>
>Var: OpHi(0),
>  OpLo(0),
>  ID1(0),
>  ID2(0);
>
>IF T = Sess1StartTime + BarInterval THEN BEGIN
>   OpHi = H;
>   OpLo = L;
>END ELSE BEGIN
>   OpHi = OpHi[1];
>   OpLo = OpLo[1];
>END;
>
>IF LastBarOnChart THEN BEGIN
>   ID1 = Text_New(Date,Sess1StartTime + BarInterval,OpHi,NumToStr(OpHi,2));
>   Value1 = Text_SetColor(ID1,6);
>   Value2 = Text_SetStyle(ID1,1,0);
>   ID2 = Text_New(Date,Sess1StartTime + BarInterval,OpLo,NumToStr(OpLo,2));
>   Value1 = Text_SetColor(ID2,6);
>   Value2 = Text_SetStyle(ID2,1,1);
>END;
>
>Plot1(0,"");  {Query: Is there any way to eliminate this Plot
>statement?  The study won't verify unless I add a Plot statement, but
>the Plot statement is superfluous when all I'm wanting is a text writing
>study.  Maybe this is just one of those "if it ain't broke, don't fix
>it" situations?}