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

RE: [amibroker] Re: Backtesting Issues



PureBytes Links

Trading Reference Links




<SPAN 
class=026340814-04102003>hmmm. I can't actually run this without formulas for 
your variables one, two, three etc. 
<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003>by a dummy sell signal, I assume you mean sell = 0;, 
yes? that won't sell ever, letting your stops do all the 
work.<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003>are the sells taking place on the days you think they 
should be, but with wrong prices, or are the exits not happening at your 
intended times at all?
<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003>what kind of wrong are the sell prices? can you match 
them up to open, close, high, low, or avg prices on the sell days, or some 
day near there? have you done an explore that shows SellPrice? any 
surprises in there? anything that matches the backtest sell 
prices?
<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003>just fishing, but hth,
<SPAN 
class=026340814-04102003> 
<SPAN 
class=026340814-04102003>dave
<BLOCKQUOTE 
>Thanks 
  Dave.  I see what you mean.  However if I am to set profit and 
  stop loss targets with Applystop, how do I implement the Sell command 
  since the Backtester won't let me run a scan without it.I did run the 
  scan through with a dummy Sell signal and still got incorrect numbers for 
  sell prices.  I've tried rewording the code and running it through a 
  simple Explore and it seems to work fine.Here's the latest 
  formula.  Maybe someone can run it through a backtest themselves to 
  see where I'm wrong.  The person who soles this will have my 
  everlasting 
  gratitude!!!*******************************SetTradeDelays(0,0,0,0);SetOption("ActivateStopsImmediately",1);  
  SetOption("AllowSameBarExit",1);  BuySig = One AND two 
  AND three AND four AND five AND six AND seven AND eight AND nine AND ten; 
  Buy = Ref (buysig, -1) AND High > ( Ref (High, -2) + 0.03 ) ; 
  BuyPrice = ValueWhen (BuySig, Ref (High, -1) + 0.03 ) ; // might 
  also need alternative BuyPrice if the Low of the Day is greater than the 
  High,-2StopLoss = ValueWhen( BuySig, Ref( Low, -2 ) - 0.01 );  
  //Low of three days before buy minus 0.01ApplyStop (stopTypeLoss, 
  stopModePoint, StopLoss, True, True); //Stop loss based on low of 3 days 
  prior to stock purchaseApplyStop (stopTypeProfit, stopModePercent, 6, 
  True) ; //Profit target of 6% activated immediatelySell = RSI (9) 
  > 
  500;*****************************************TIA,Chris--- 
  In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx> 
  wrote:> I think you're misunderstanding ApplyStop. simply calling 
  ApplyStop puts a> rule in place that the backtester will use from 
  there on out. it doesn't> return a value that you later have to 
  manually exit with, using a 'sell => something' statement like you 
  have.> > all you need is> 
  >     ApplyStop([parameters])> > 
  that's it.> > dave>   I'm in need of some help 
  with a backtest here.  I'm able to get my>   profit 
  stops to kick in no problem, but for some reason my stop 
  loss>   doesn't work properly- the results are all over 
  the map!> >   Graham has been helping me a lot with 
  this the past week (thanks>   bud!) but I'm starting to feel 
  bad about taking up so much of his>   time and no matter how 
  much I tinker with this, it won't work.> >   Here's my 
  code with all my buy criteria (one through ten) not>   
  included as they're really not relevant anyway)> > 
  >   
  ***************************************>   
  SetTradeDelays(0,0,0,0);> >   
  SetOption("ActivateStopsImmediately",1);> >   
  SetOption("AllowSameBarExit",1);> >   BuySig = One AND 
  two AND three AND four AND five AND six AND seven>   AND 
  eight AND nine AND ten;> >   Buy = Ref (buysig, -1) 
  AND High > ( Ref (High, -2) + 0.03 ) ;> >   
  BuyPrice = ValueWhen (BuySig, Ref (High, -1) + 0.03 ) ;>   // 
  might also need alternative BuyPrice if the Low of the Day 
  is>   greater than the High,-2> >   
  StopLoss = ValueWhen( BuySig, Ref( Low, -2 ) - 0.01 );  //Low 
  of>   three days before buy minus 0.01  I THINK THIS IS 
  WHERE THE PROBLEM>   IS!!> >   
  Exit1 = ApplyStop (stopTypeLoss, stopModePoint, StopLoss, 
  True,>   True); //Stop loss based on low of 3 days prior to 
  stock purchase> >   Exit2 = ApplyStop (stopTypeProfit, 
  stopModePercent, 6,>   True) ; //Profit target of 6% 
  activated immediately> >   Sell = Cross (Exit1, Low) 
  OR Cross (Exit2, High);> >   Buy = ExRem( Buy, Sell 
  );> > > >   Thanks in advance 
  everyone!>   ChrisSend 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT<img
src="" width=300 height=250 border=0>  









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.