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

Re: Debugging TS4 Text-on-Chart Code --- Fixed !!!



PureBytes Links

Trading Reference Links

Dear Group,

Yesterday, I posted some code here and asked for suggestions.  Massimo
(maxci@xxxxxx) and Bob Fulks (bfulks@xxxxxxxxxxxx) generously Emailed me
privately with their respective suggested code, both of which worked.  From
their suggestions, I have written the following code:

{Writes in text the numeric values of today's opening high and low above and
below today's opening bar on the chart}

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

IF Date[1] < Date THEN BEGIN
    OpHi = H;
    ID1 = Text_New(D,T,OpHi,NumToStr(OpHi,2));

    OpLo = L;
    ID2 = Text_New(D,T,OpLo,NumToStr(OpLo,2));
END;

IF 0 = 1 THEN Plot1(0,"");

*****

The foregoing centers the numeric value above and below the bar.  If I want
to put it to the left of the bar and at a height within the bar height, I
would add the following statements:

Text_SetStyle(ID1,1,0);
Text_SetStyle (ID2,1,1);

*****

Frankly, this turned out to be much simpler than I had imagined.  That seems
usually to be true.

Gentlemen, thank you again for your assistance.

Sincerely,

Richard




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