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

[amibroker] Backtesting Issues



PureBytes Links

Trading Reference Links

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!
Chris


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/