PureBytes Links
Trading Reference Links
|
Marco,
I've quickly tested the code, using the Cum(1) function, and made
a few adjustments.... Herewith the same stuff, but with a few bugs
fixed! Note that there may remain some more, so now is a good time
to read the disclaimer....
Anyhow, hope this is closer to the mark. Also, see the note at the
end.
Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com
----8<----------------------------------------------------------------
{Create two custom sized bars
Results in B1O/H/L/C and B2O/H/L/C
For personal use only
MG Ferreira
http://www.ferra4models.com
http://fun.ferra4models.com
}
{Indicators we wish to filter, replace with your stuff
Could be the same, i.e. T2 := T1
}
T1 := RSI(14);
T2 := RSI(14);
{Bar lengths}
N1 := Input("First bar length",1,9999,5);
N2 := Input("Second bar length",1,9999,45);
{Counters we need}
II := Cum(1) - 1;
{Counters for N1}
M1 := Mod(II,N1);
J1 := M1 = (N1-1);
K1 := M1 = 0;
{Counters for N2}
M2 := Mod(II,N2);
J2 := M2 = (N2-1);
K2 := M2 = 0;
{Construct N1 bar from indicator T1}
B1O := Ref(Sum(T1*K1,N1),-N1+1);
B1H := Sum(HHV(T1,N1)*J1,N1);
B1L := Sum(LLV(T1,N1)*J1,N1);
B1C := Sum(T1*J1,N1);
{Construct N1 bar from ticker O/H/L/C}
B1O := Ref(Sum(OPEN*K1,N1),-N1+1);
B1H := Sum(HHV(HIGH,N1)*J1,N1);
B1L := Sum(LLV(LOW,N1)*J1,N1);
B1C := Sum(CLOSE*J1,N1);
{Construct N2 bar from indicator T2}
B2O := Ref(Sum(T2*K2,N2),-N2+1);
B2H := Sum(HHV(T2,N2)*J2,N2);
B2L := Sum(LLV(T2,N2)*J2,N2);
B2C := Sum(T2*J2,N2);
{Construct N2 bar from ticker O/H/L/C}
B2O := Ref(Sum(OPEN*K2,N2),-N2+1);
B2H := Sum(HHV(HIGH,N2)*J2,N2);
B2L := Sum(LLV(LOW,N2)*J2,N2);
B2C := Sum(CLOSE*J2,N2);
{Note: contains some lag, to take out the lag, use
*****
B1OL := Ref(B1O,N1-1)
B1HL := Ref(B1H,N1-1)
...
Note: this introduces some look ahead, as the formula
now 'sees' what the high/low/close of the current
bar will be before we get to the end of it
}
----8<----------------------------------------------------------------
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|