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

Re: EL Code Stumper



PureBytes Links

Trading Reference Links

Dear All,

Recently I asked the list how to print a variable on the screen.  I would like to
thank Bob Fulks for pointing the way.  The
solution uses the "Text_New" function and the "NumToStr" function.  I have
several systems with have complex calculations
which I like to check manually before taking the signals.  The code below shows
how to output a variable to the screen. This
allows an immediate review of the variable which is generating the signal. Also
see the attached .ELA file named "ScrnText".

To show how this works I have added the required code to the "XAverage Crossover"
system comes with TS 4.0.
When the system gives a buy signal the code plots the fast MA value on the
highest 10 day high.
When the system gives a sell signal the code plots the slow MA value on the
lowest 10 day low.


Input: Length1(4),Length2(9);
IF CurrentBar > 1 and XAverage(Close,Length1) crosses above
XAverage(Close,Length2) Then begin
 Buy on Close;
 Value1 = Text_New(Date,Time,Highest(H,10),NumToStr(XAverage(Close,Length2),2));
{Fast MA}
End;


IF CurrentBar > 1 and XAverage(Close,Length1) crosses below
XAverage(Close,Length2) Then begin
 Sell on Close;
 Value2 = Text_New(Date,Time,Lowest(L,10),NumToStr(XAverage(Close,Length1),2));
{Slow MA}
End;

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

Bob Fulks wrote:

> At 2:03 PM -0600 3/10/98, Patrick M wrote:
> >
> >
> >Dear EL Programmers,
> >
> >I am trying to output text to the screen based on the current value of a
> >variable or input.  If you look at the "CandleStick Pattern" indicator
> >which comes with TS 4.0 you can see that it puts hard coded text on the
> >price chart when a pattern is identified.  I need to output the same type
> >of text but I need the text to reflect the current value of a variable or
> >input.  Is this possible?
> >
> >
>
> Attached is code that does something similar to what you required. It is a
> part of some other code so may not verify as it stands. Please consider it
> as an example of what is required.
>
> To convert the value of a numeric variable to a string variable (like the
> variable "Str" below), you need to use the "NumToStr" function.
>
> Hope this helps.
>
> Bob Fulks
>
> Vars:  X(FALSE),      {In X column when true, O when false}
>        Display(FALSE),{Enables display on this bar}
>        StOffset(0),   {Offset to start plotting line under title}
>        Str(""),       {String variable to plot text}
>        DLine(0),      {Date line value to plot text}
>        VLevel(0),     {Vertical level to plot text}
>        VOffset(3),    {Vertical offset for text above bars}
>        Rng(0),        {Range}
>
> Display = TRUE;
> StOffset = 2;
> Str = "XXX";
>
> {Display text and line under text}
>
> if Display then begin
>   VLevel = Highest(H, StOffset + 1) + VOffset;
>   Value4 = StOffset/2;
>   DLine  = iff(Mod(StOffset, 2) = 0, 2, 0);
>
>   Value1 = Text_New(Date[Value4],Time[Value4], VLevel, Str);
>   Value2 = Text_SetStyle(Value1,DLine,2);
>   Value2 = Text_SetColor(Value1,Tool_Yellow);
>
>   Value3 = TL_New(Date[StOffset],Time[StOffset], VLevel, Date, Time, VLevel);
>   Value2 = TL_SetColor(Value3, Tool_Yellow);
>   Value2 = TL_SetExtLeft(Value3, FALSE);
>   Value2 = TL_SetExtRight(Value3, FALSE);
>   Value2 = TL_SetAlert(Value3,0);
> end;



Attachment Converted: "c:\eudora\attach\Scrntext.ela"