Hyper Geometric Random Variable

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Hyper Geometric Random Variable

Postby Napatanpics » Thu Feb 11, 2010 10:39 am

HGRV

Hello & regards...

The HGRV(hypergeometric random variable) if you have a box/Jar with 18 marbles; 11 green(up-candles, ie open<close) & 7 red(down-candles; open>close).

If you then select a sample of 4 marbles at random, how much should one expect to be green(in sample)?
This is the expected value for the HGRV, in words the size of sample multiplied by the # of green marbles, divided by the total # of marbles

or E[X] = 4*11/18, the expected value for the HGRV, would like to plot/draw this

Would like to see it run on FXCM, real time, can anyone help with a code.

one way would be to count the candles using open & close for each i, count the cases for open>close & open<close this would be the total marbles(ignore cases for open=close)
Then allow a choice for sample size, for example on the 1 hr chart, if the sample is 4, the expected value would indicate how much up candles to expect(wont necessarly be a reality) from a sample of 4...

Thanks(the updates 2,3,4,5,6...8hr charts, very nice, quite happy for)

Tanutamen
Napatanpics
 
Posts: 4
Joined: Thu Feb 11, 2010 10:31 am

Re: Hyper Geometric Random Variable

Postby Nikolay.Gekht » Thu Feb 11, 2010 10:50 am

The idea is interesting. I'll take look at the implementation at shortly.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Hyper Geometric Random Variable

Postby Napatanpics » Sun Mar 14, 2010 11:27 am

http://www.gftforex.com/forum/displaytopic.asp?T=1676

The above is a link to the CTL forum for GFT, there is an
Intraday momentum index indicator, from their library that appears to do the trick
with a slight modification

/* Hyper Geometric Random Variable*/
indicator Hyper_Geometric_Random_Variable;
input period = 30;
draw cmo("HGRV");
vars i(number), u(series), d(series), au(series), ad(series), dif(number), f(number);
begin
for i := front(open) to back(open) do begin
dif := close[i] - open[i];
if dif > 0 then begin
u[i] := dif;
d[i] := 0;
end else begin
u[i] := 0;
d[i] := -dif;
end;
end;
au := sma(u, period);
ad := sma(d, period);
for i := front(au) to back(au) do begin
dif := au[i] + ad[i];
if dif = 0 then
cmo[i] := 0
else
cmo[i] := 5 * au[i] / dif;
end;
end.

here looking at 30-candles on any time frame, this selects 5 & gives projection form how much "up"-candles to expect out of 5. on a daily candle chart the figure would print how much up candles to expect for the week(5 days)

Again this is the CTL-language quite similar to code used here, can anyone translate it
to a FXCodeBase for FXCM platform implementation, it works on GFT, GFT doesnt provide hedging!

Again regards....
Napatanpics
 
Posts: 4
Joined: Thu Feb 11, 2010 10:31 am

Re: Hyper Geometric Random Variable

Postby Nikolay.Gekht » Mon Apr 26, 2010 7:42 pm

I apologize for the delay. The new release and heap of requests almost overwhelmed me. :-(

I tried to implement your idea.

It looks something like this:
HGRV.png


HGRV.lua
(1.91 KiB) Downloaded 941 times
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Hyper Geometric Random Variable

Postby Napatanpics » Fri Apr 30, 2010 8:18 pm

Yes I see, you have it running on the red candles also, what is the code that looks like a 10 min chart on last Monday

post a daily chart with only GC on it....

Its a "easy to read" indicator
Napatanpics
 
Posts: 4
Joined: Thu Feb 11, 2010 10:31 am

Re: Hyper Geometric Random Variable

Postby Napatanpics » Fri Apr 30, 2010 11:16 pm

After staring at it for a while it is better to run both GC & RC

Thats great, at least we got some response/dialogue here compared to the GFT thread

When can one run it on FXCM?

Again that was VERY good
http://sites.google.com/site/tanutamen/
Napatanpics
 
Posts: 4
Joined: Thu Feb 11, 2010 10:31 am


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 29 guests