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

[amibroker] ApplyStops & trade exit/entry question



PureBytes Links

Trading Reference Links

I'm running backtests and I'm getting false Stop values. All exits are via the ApplyStop 
function. Entries as per code, on the open of next bar after signal. What's happening is 
that the exit price (delay = 1) is the Low/High of the bar & the Buy/Short is the same. 
Obviously this has me entering and exiting a trade at the best possible price, whereas I 
should be exiting at the Stop price & entering on open. I tried all differing combos, but 
I cannot get it to enter/exit correctly ont the delayed bar.

Snippet of code as follows:

Buy =C1 AND ValueWhen(C1,TimeNum()) >= StartT AND ValueWhen(C1,TimeNum()) <= EndT;
BuyPrice = ValueWhen(C1,C2) ;
Sell=0;
SellPrice=0;

Short = C2 AND ValueWhen(C2,TimeNum()) >= StartT AND ValueWhen(C2,TimeNum()) <= EndT;
ShortPrice = ValueWhen(C2,C3) ;
Cover=0;
CoverPrice =0;
Profit = 0.0050;
Loss= 0.0015;
ApplyStop(stopTypeProfit,stopModePoint,Profit,2,0,1);
ApplyStop(stopTypeLoss,stopModePoint,Loss,2,0,1);

Under the "Settings"  General tab I've unchecked everything except Futures (I tried all 
combo's but cannot get it right) Under the  Trades tab settings are Buy/Short = Open, 
delay 1, & Sell/Cover = Open, delay 1 (though I thought the "Sell/Buy = 0" statement 
bypassed these settings??) & all Stops are disabled via the dialogue.

Can someone please point out what I'm doing wrong, or what I need to do to fix this? 
Thanks!



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/