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

[amibroker] Re: Coding Question



PureBytes Links

Trading Reference Links

Same base logic, prettier histogram :)

Green bars greater than zero by ratio of HHV up days over HHV down 
days. Red bars less than zero by ratio of HHV down days over HHV up 
days (multiplied by -1).

Periods = Param("Periods", 20, 1, 100, 1);
UpDayVolume = IIF(Close > Open, Volume, 0);
DownDayVolume = IIF(Close <= Open, Volume, 0);
HHVUpDayVolume = HHV(UpDayVolume, Periods);
HHVDownDayVolume = HHV(DownDayVolume, Periods);

ColorBars = IIF(HHVUpDayVolume > HHVDownDayVolume, colorGreen, 
colorRed);
Plot(IIF(HHVUpDayVolume > HHVDownDayVolume, 
HHVUpDayVolume/HHVDownDayVolume, IIF(HHVDownDayVolume > 
HHVUpDayVolume, HHVDownDayVolume/HHVUpDayVolume * -1, 0)), "HHV 
Ratio", ColorBars, styleHistogram);

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Hi,
> 
> I'm not sure what you meant by "compare", but I believe that the 
> following will at least get you going.
> 
> The end result is a histogram such that the values are the ratio of 
> the HHV up days compared to the HHV down days.
> 
> Days where the HHV of up days was greater will be green and have a 
> value greater than 1. Days where the HHV of down days was greater 
> will be red and have a value less than 1. Days where the two HHV 
are 
> equal will be red (i.e. treated as down days) and will have a value 
> of 1.
> 
> For example; if the HHV of up days in the last x days was 1000 and 
> the HHV of down days in the same last x days was 800, then the 
> histogram bar will have a value of 1000/800 = 1.25 and be painted 
> green.
> 
> If the HHV of up days in the last x days was 800 and the HHV of 
down 
> days in the same last x days was 1000, then the histogram bar will 
> have a value of 800/1000 = 0.8 and be painted red.
> 
> The periods (i.e. x in the examples above) is a configurable 
> parameter.
> 
> The farther a value is from 1, the greater was the difference (i.e. 
> values approaching infinity mean HHV of up day volume was much 
> greater than HHV of down day volume, values approaching zero mean 
HHV 
> of down day volume was much greater than HHV of up day volume).
> 
> Periods = Param("Periods", 20, 1, 100, 1);
> UpDayVolume = IIF(Close > Open, Volume, 0);
> DownDayVolume = IIF(Close <= Open, Volume, 0);
> HHVUpDayVolume = HHV(UpDayVolume, Periods);
> HHVDownDayVolume = HHV(DownDayVolume, Periods);
> 
> ColorBars = IIF(HHVUpDayVolume > HHVDownDayVolume, colorGreen, 
> colorRed);
> Plot(1, "Equal", colorDarkGrey, styleLine);
> Plot(HHVUpDayVolume/HHVDownDayVolume, "Up:Down ratio", ColorBars, 
> styleHistogram);
> 
> Hope that helps,
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "chorlton_c_hardy" <chorlton-c-
> hardy@> wrote:
> >
> > Hello All,
> > 
> > Can anyone help with this coding problem?
> > 
> > Over the last 'x' periods, I want to compare the HHV of Volume 
that 
> > occurred on a DownDay against the HHV of Volume that occurred on 
an 
> > Upday?
> > 
> > where:
> > UpDay = C > O
> > DownDay = C < O
> > 
> > 
> > Any ideas on how I could go about doing this?
> > 
> > Thanks in advance..
> >
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/