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

Re: Color on Histogram



PureBytes Links

Trading Reference Links

>Subject:          Re: Color on Histogram
>   Date:          Wed, 04 Nov 1998 22:06:46 GMT
>   From:         ribau@xxxxxxxxxxxxx
>     To:          omega-list@xxxxxxxxxx
>
>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