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

Re: [EquisMetaStock Group] How to create a synthetic OHLC ?



PureBytes Links

Trading Reference Links


Marco,

One fine adjustment to the code.  Change the second input from

N2 := Input("Second bar length",1,9999,9);

to

N2 := Input("Second bar length",1,9999,45);

Note the '9' becomes '45'.  If you look at the code, you'll see the
second bar is simply a copy of the first, and they are not related at
all.  Thus I construct a 5 day bar and, independantly, a 45 day bar. 
Hope this is what you have in mind.  It is not required to explicitly
make them dependent (e.g. 45 = 9 x 5).

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 



--- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" <quant@xxxx> wrote:
> 
> Hi Marco,
> 
> Not entirely sure what you are trying to do, but this may help.
> Note that I haven't properly tested it, it may need a Ref(...,-N1)
> for the highs and lows.  I just made sure it compiles in MS.  Let
> me know if this is what you need, and how you had to change it to
> get it to work.  Code follows below.
> 
> 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}
> 
> {Indicators we wish to filter, replace with your stuff}
> T1 := RSI(14);
> T2 := RSI(21);
> 
> {Bar lengths}
> N1 := Input("First bar length",1,9999,5);
> N2 := Input("Second bar length",1,9999,9);
> 
> {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);
> B1H := Sum(HHV(T1,N1)*J1,N1);
> B1L := Sum(LLV(T1,N1)*J1,N1);
> B1C := Sum(T1*J1,N1);
> 
> {Alternatively, construct N1 bar from ticker O,H,L,C}
> B1O := Ref(Sum(OPEN*K1,N1),-N1);
> 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(T1*K1,N1),-N1);
> B2H := Sum(HHV(T1,N1)*J1,N1);
> B2L := Sum(LLV(T1,N1)*J1,N1);
> B2C := Sum(T1*J1,N1);
> 
> {Alternatively, construct N2 bar from ticker O,H,L,C}
> B2O := Ref(Sum(OPEN*K2,N2),-N2);
> B2H := Sum(HHV(HIGH,N2)*J2,N2);
> B2L := Sum(LLV(LOW,N2)*J2,N2);
> B2C := Sum(CLOSE*J2,N2);
> 
> ----8<-------------------------------------------------------
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, khamsina11 <Khamsina11@xxxx>
wrote:
> > 
> > Hi,
> > 
> > Impossible to do ?
> > 
> > Tia
> > 
> > Marco
> > 
> > 
> > khamsina11 a écrit :
> > 
> > >
> > > Hi,
> > >
> > > What I would like to do is to filter a N1 day bar chart with
signals 
> > > from a N2-day bar (with N2 > N1).
> > > For instance :
> > > - Filter a 5 day bar chart with signals from a 45 day bar.
> > >
> > > In order to do that, I must redefine 45 days as the 45 days period 
> > > ending at the conclusion of each 5 day bar.
> > > This would be done by defining :
> > >
> > > 1) The high of the larger bar as the highest high over _nine_ 5
> day bars.
> > > 2) The low as the lowest low over the same period
> > > 3) The open as the open of the ninth bar back (ie : ref(O,-8) )
> > > 4) The close of the current bar
> > >
> > > Any help would be greatly appreciated,
> > > Thanks in advance,
> > >
> > > Marco
> > >
> > > *Yahoo! Groups Sponsor*
> > > ADVERTISEMENT
> > > click here 
> > >
>
<http://us.ard.yahoo.com/SIG=129h0qqjt/M=298184.6191685.7192823.3001176/D=groups/S=1705375617:HM/EXP=1111599804/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075>
> 
> > >
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > *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
> > >      
> <mailto:equismetastock-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > >        
> > >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > >       Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/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/