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

RE: [amibroker] Backtesting Issues



PureBytes Links

Trading Reference Links




<FONT face="Courier New" color=#0000ff 
size=2>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.
<FONT face="Courier New" color=#0000ff 
size=2> 
<FONT face="Courier New" color=#0000ff 
size=2>all you need is
<FONT face="Courier New" color=#0000ff 
size=2> 
<FONT face="Courier New" color=#0000ff 
size=2>    ApplyStop([parameters])
<FONT face="Courier New" color=#0000ff 
size=2> 
<FONT face="Courier New" color=#0000ff 
size=2>that's it.
<FONT face="Courier New" color=#0000ff 
size=2> 
<FONT face="Courier New" color=#0000ff 
size=2>dave
<BLOCKQUOTE 
>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,-2StopLoss = 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 
  purchaseExit2 = ApplyStop (stopTypeProfit, stopModePercent, 6, 
  True) ; //Profit target of 6% activated immediatelySell = Cross 
  (Exit1, Low) OR Cross (Exit2, High);Buy = ExRem( Buy, Sell ); 
  Thanks in advance 
everyone!Chris






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.