I don't think that is his problem. I believe he needs to change the state using Flip i.e. sell=Flip(VSell,VBuy);
John --- In [email protected], "brian.z123" <[EMAIL PROTECTED]> wrote: > > DM, > > I don't think it matters if you stipulate Fri or not. > > Fri Close is the *default* close for weekly bars. > > In 2006 only one week did not close on a Fri (public holiday?) in the > US market (4/13/2006 was a Thursday weekly close). > > I think that if you accepted the weekly close for all weeks your > backtests would not be adversely affected. > > The only week that is compromised is the current week, so for > backtesting if you set the range to avoid the current week you should > be OK. > > If you are in weekly bars that would leave you with: > > sell = C < HHC(C,52) * 0.96; > > If you are using daily bars: > > WC = TimeFrameCompress(Close,inWeekly); > > sell = WC < HHV(WC,52) * 0.96; > > WC code courtesy of Ami AFL reference. > > BrianB2 > > --- In [email protected], Dave McLeod <dmcleod1981@> wrote: > > > > I am trying to code the Zweig 4% reversal system but I am not > catching on as to how to limit the buys and sells from each week. > > > > Your supposed to buy if the Close drops 4% below the HHV of the > last 52 weeks and buy if the Close is greater than the LLV of the > last 52 weeks based on Fridays close. > > > > Here is what I have so far. > > > > DOW=DayOfWeek()==5; > > Hi=HHV(Close,52); > > Lo=LLV(Close,52); > > VBuy = Close*1.04>=Ref(Lo,-1) AND DOW; > > VSell = Close*.96<=Ref(Hi,-1) AND DOW; > > Buy = ExRem(VBuy,VSell); > > Sell = ExRem(VSell,VBuy); > > > > This buys and then sells each week. I am obviously not using > exrem correctly and it still buys weekly wether I have DOW in or out. > > > > If someone could point out my mistakes that would be great. > > > > Thanks > > DM > > > > > > --------------------------------- > > We won't tell. Get more on shows you hate to love > > (and love to hate): Yahoo! TV's Guilty Pleasures list. > > >
