PureBytes Links
Trading Reference Links
|
Hi Gary
You wrote:
> I use the attached indicator to place arbitrary labels on a chart. I
> don't know any way in EL to get the current system name, but you
> could manually apply the indicator with the correct system name.
> The trouble I had was placing the text on the chart. I wanted it to
> stay near the right side of the chart, so I had to place it
> explicitly in the code. As far as I know, there is no way to find
> the current max & min price displayed on a chart, so I fudged by
> looking at the max/min price in the last 200 bars. This doesn't
> always work very well, but usually it works "well enough."
> If somebody has a better answer, I'd like to see it.
> Gary
>
> { Indicator: Chart Label }
>
> Inputs: Label("Label");
>
> Vars: TxtObj(0), Hi(0), Lo(0);
>
> if CurrentBar = 1 then begin
> TxtObj = Text_New(Date,Time,Close,Label);
> Text_SetStyle(TxtObj,1,2); {Left, Centered}
> Text_SetColor(TxtObj,Tool_Yellow);
> end;
> if LastBarOnChart then begin
> Hi = Highest(H,200);
> Lo = Lowest(L,200);
> if (C-Lo)/(Hi-Lo) > 0.5
> then Text_SetLocation(TxtObj, Date, Time, Lo+(Hi-Lo)/10)
> else Text_SetLocation(TxtObj, Date, Time, Hi-(Hi-Lo)/10);
> end;
>
> if False then plot1(0,"");
I use something like this to be sure text doesn't interfer with past price action:
{ Indicator: Chart Label }
Inputs: Label("Label"),Incr(100),Len(40);
Vars: TxtObj(0), Hi(0), Lo(0);
Hi = Highest(H,Len);
if CurrentBar = 1 then begin
TxtObj = Text_New(Date,Time,Close,Label);
Text_SetStyle(TxtObj,1,1); {Left, Above}
Text_SetColor(TxtObj,Tool_Yellow);
end;
if LastBarOnChart then Text_SetLocation(TxtObj, Date, Time, Hi);
Plot1(Hi+Incr,"");
Plot on price data, plot1 color as background,len inputs as long as required by length of
text, Incr (in the same price units of the market charted) to set so to leave enough room for
the text to show.
--
Best Regards
Massimo Ciarafoni
"Example is not the main thing in influencing others; it's the only thing."-Albert Schweitzer
|