Ray, can you explain in words how the filters are supposed to work?
T.O. --- In [email protected], "me_rayme" <[EMAIL PROTECTED]> wrote: > > Has anybody converted this to AB and would love to share including > the plot info. Interesting article. > > Ray > > June 2007 activetradermag. > TradeStation code for "Short-term, channel trading ," p. 29 > > The base strategy > inputs:length(10); > vars:lrgh(0),lrgl(0); > lrgh=linearregvalue(h,length,0); > lrgl=linearregvalue(l,length,0); > buy next bar at lrgh stop; > sell short next bar at lrgl stop; > > The first filter > if (lrgh > lrgh[1] ) then buy next bar at lrgh stop; > if (lrgl < lrgl[1] ) then sell short next bar at lrgl stop; > > The second filter > if (lrgh < lrgh[1] and c<lrgh ) then buy next bar at lrgh stop; > if (lrgl > lrgl[1] and c>lrgl ) then sell short next bar at lrgl stop; > > Behle-Conway modified exit strategy > > Inputs: stopbars(3), exitfactor(0.25), > length(14), profitbars (3), profitfactor (0.9); > Vars: sellstop(0),Coverstop(0),ATR(0), selltarget1(0),covertarget1 > (0),selltarget2(0),covertarget2(0); > ATR=Avgtruerange(length); > Sellstop=lowest(low,stopbars)-(exitfactor*ATR); > Coverstop=highest(high,stopbars)=(exitfactor*ATR); > Selltarget1 =h+(profitfactor*atr); > Covertarget1=low - (profitfactor*atr): > Selltarget2=highest(h,profitbars)+(2*profitfactor*atr); > Covertarget2=lowest(l,profitbars)-(2*profitfactor*atr); > If marketposition<>0 then begin > Sell next bar at sellstop on stop; > Buy to cover next bar at coverstopon stop; > End; > If Marketposition<>0 then begin > > Sell currentcontracts/2 contracts next bar at selltarget1 on stop; > Buy to cover currentcontracts/2 contracts next bar at covertarget1 on > stop; > Sell next bar at selltarget2 on stop; > Buy to cover next bar at covertarget2 on stop; >
