PureBytes Links
Trading Reference Links
|
> my question is, can someone modify the code, that it will also put
> the fib level as text on the screen?
This is untested but should be very close. Drop the init code
near the start of your indicator, then put the "Copy values" &
following code after you have computed your value7/8/9 values.
Set TS to display some space to the right of the chart (right-
click chart, Properties, Bars to Right). Set the BarOffset input
to adjust how far to the right of the price you want the text to
display. Because it uses BarInterval to calculate the text
location, it assumes you're using minute charts. If you aren't,
you'll have to adjust that calculation.
Gary
===
inputs: BarOffset(10); { # bars to right of price to display text }
vars: Init(true), COP_obj(0), OP_obj(0), XOP_obj(0),
COP(0), OP(0), XOP(0), LblTime(0);
{ Create and initialize the text objects }
if Init then begin
COP_obj = Text_New(Date, Time, Close, "x");
OP_obj = Text_New(Date, Time, Close, "x");
XOP_obj = Text_New(Date, Time, Close, "x");
Text_SetStyle(COP_obj, 0, 1); { Centered, right of Date/Time }
Text_SetStyle(OP_obj, 0, 1);
Text_SetStyle(XOP_obj, 0, 1);
Init = false;
end;
{ Copy values into more readable variable names }
COP = value7;
OP = value8;
XOP = value9;
{ On last bar, display text BarOffset bars to the right }
if LastBarOnChart then begin
Text_SetString(COP_obj, "COP: " + NumToStr(COP, 2));
Text_SetString(OP_obj, "OP: " + NumToStr(OP, 2));
Text_SetString(XOP_obj, "XOP: " + NumToStr(XOP, 2));
LblTime = CalcTime(Time, BarOffset*BarInterval);
Text_SetLocation(COP_obj, Date, LblTime, COP);
Text_SetLocation(OP_obj, Date, LblTime, OP);
Text_SetLocation(XOP_obj, Date, LblTime, XOP);
end;
|