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

re: EL help with text display



PureBytes Links

Trading Reference Links

My sincere thanks to Bob Perry, Massimo Ciarafoni, Chad, and all who
responded to my text display questions over the weekend.

The goal was to create an updating display on the right side of the screen
showing a value from the previous bar.  The following example uses a simple
moving average.

An example of usage might be to display an updated exit point for trailing
stops.

It's my first attempt at text display, so there may be more elegant
solutions, but, hey, it works...

Since the example has text writing to the right side of the chart in the
empty space created by "Bars to Right",
it's suitable as is only for TS2K.

Cheers,

Kimball Morgan


(code follows...)
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
 - example for use on S&P contracts;
 - chart has "Bars to Right" set to 12;
 - HDistance (Horizontal Distance) adds to timeline;
 - VDistance (Vertical Distance) is the number of bars for the highest high,
   to keep the display from excessive vertical movement;
-  Uncheck "Update every tick".

 - last edit 03/03/2001.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~}

input: HDistance(8), VDistance(100), Color(Tool_DarkGreen);

vars: MA(0), Exit(-1), OldExit(-1);

MA = average(close,21);

if BarNumber = 1 then
 Exit = Text_New(date, time, Close, NumToStr(MA,2))

else begin

 value1 = Text_SetLocation(value1, Date, Time + HDistance,
Highest(h,VDistance));

 value2 = Text_SetString(value1, NumToStr(MA,2));

 value3 = Text_SetColor(Value1,Color);

if OldExit <> -1 then
 value4 = Text_Delete(OldExit);

end;