Dont have time to go through code...but you need to: - test in daily mode - develop your stop in weekly mode and apply in daily
example: TimeFrameSet(inweekly) compute stop indicator TimeFrame Restore() stopindicator = TimeFrameExpand(inweekly....) // have to do this to match daily bars Use in daily test mode You might plot "stopindicator" to get a sense of what it looks like ----- Original Message ----- From: "GMAN795" <[email protected]> To: <[email protected]> Sent: Saturday, April 24, 2010 10:27 AM Subject: [amibroker] Re: Help with TimeFrameSet > Thanks for the reply. > > That's the problem I'm running into. I thought it may be the code. > I can do the backtest in daily but run into problems with changing the ATR > to weekly. > Any suggestions on how the following stop can be set to weekly? > > > > TrailATR= 2.5*ATR(15); > Initial=C-TrailATR; > > stop[ 0 ] = Close[ 0 ]; > for( i = 1 ; i < BarCount; i++) > { > if( Close[ i ] > stop[ i - 1]) > { > temp = Close[ i ] - TrailATR[ i ]; > if( temp > stop[ i - 1 ] ) stop[ i ] = temp; > else stop[ i ] = stop[ i - 1 ]; > } > else > stop[ i ] = Initial[ i ]; > > } > > sell = close < ref( stop, -1); > > > > --- In [email protected], "Ara Kaloustian" <a...@...> wrote: >> >> Your formula looks correct but you may have a problem with TimeFrame. >> >> If your time Frame is set to Weekly, I don't think you can switch to >> Dialy >> data. >> >> The time Frame functions are meant to work the other way (going from >> Daily >> to Weekly etc). >> >> I have not tested your code, but I beleive you will run into problems due >> to >> the time frame issue, >> >> >> ----- Original Message ----- >> From: "GMAN795" <gman...@...> >> To: <[email protected]> >> Sent: Saturday, April 24, 2010 9:15 AM >> Subject: [amibroker] Help with TimeFrameSet >> >> >> > I've got a weekly system that I'm backtesting but would like to enter >> > the >> > day after a 4% gain from the previous day. >> > Is this the proper code? >> > >> > TimeFrameSet(inDaily); >> > ROC_4 = roc(c,1) > 4; >> > TimeFrameRestore(): >> > >> > buy = TimeFrameCompress(ROC_4,inDaily); >> > AND EMA(c,10) > EMA (c,30) >> > and Volume > ref(v,13),-1); >> > >> > I then have a trailing stop based on a weekly ATR. >> > >> > Thanks >> > >> > >> > >> > ------------------------------------ >> > >> > **** IMPORTANT PLEASE READ **** >> > This group is for the discussion between users only. >> > This is *NOT* technical support channel. >> > >> > TO GET TECHNICAL SUPPORT send an e-mail directly to >> > SUPPORT {at} amibroker.com >> > >> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at >> > http://www.amibroker.com/feedback/ >> > (submissions sent via other channels won't be considered) >> > >> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: >> > http://www.amibroker.com/devlog/ >> > >> > Yahoo! Groups Links >> > >> > >> > >> > > > > > ------------------------------------ > > **** IMPORTANT PLEASE READ **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > > TO GET TECHNICAL SUPPORT send an e-mail directly to > SUPPORT {at} amibroker.com > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > http://www.amibroker.com/feedback/ > (submissions sent via other channels won't be considered) > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > Yahoo! Groups Links > > >
