PureBytes Links
Trading Reference Links
|
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,-2
StopLoss = ValueWhen( BuySig, Ref( Low, -2 ) - 0.01 ); //Low of
three days before buy minus 0.01
ApplyStop (stopTypeLoss, stopModePoint, StopLoss, True,
True); //Stop loss based on low of 3 days prior to stock purchase
ApplyStop (stopTypeProfit, stopModePercent, 6, True) ; //Profit
target of 6% activated immediately
Sell = 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!
> 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/
|