PureBytes Links
Trading Reference Links
|
> >Thanks for replying and sending the ela file, Gerald. What I was >trying
> >to code was an indicator that would paint the MACD hist bar >green if it
> >has risen in relation to the previous bar (increased >value), and paint
> >the MACD hist bar red if it is lower than the >previous bar (decreased
> >value), regardless of whether the bar is >above or below the zero line.
> >
> >Give my code a try and you'll see what the concept is, it makes it
> >>easier to see when MACD is signaling that the market is finding >support
> >and may be ready to rally from a previous bearish signal, >and vice
> >versa.
> >
> >The code works well on EOD data (I've cleaned it up a little). The
> >>problem occurs when it is applied to live intraday data. If the >hist is
> >rising during a tick, then reverses, that bar becomes a >green bar with a
> >red bar superimposed over it.
>
> The problem is that once a bar is painted, it stays in the graphics
> memory. If you paint over it it will disappear. If you paint over part
> of it, you get the second color and some of the first.
>
> The solution has been mentioned here before. You must repaint the
> previous value in the background color to obliterate it, then paint the
> new value in its color. This may be difficult, however, if updating on
> every tick, since TS updates variables only at the close of a bar, not by
> tick. The previous painted value (a tick) is gone, unless you use global
> variables to save it.
>
> donc
I spent some time and some 20 codes on that ystd with no result - the
overpainting trick (mentioned here before by DENNIS HOLVERSTOTT) does the
trick only half, as it overpaints correctly on the FINISHED bar - resulting the same
as NOT update each tick......however the CURRENT bar still gets BOTH colours
if the indicator crosses over DURING the bar,,,,,,and that is not wanted.
ideas ?
rgds hans
|