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

Re: [amibroker] Anyone able to access Amibroker AFL Library



PureBytes Links

Trading Reference Links




Group,
 
To avoid slippage one may use Limit orders. I am 
trying to simulate ways in which it is likely a Limit order will be 
executed.
 
For instance if one is able to retrieve the 
open price just AFTER the open and enter a limit order at the open price 
(seconds after the opening bell) with your broker this order is likely to 
be filled if the price during the day moves lower than the open.
 
With the tradedelays set to 1, one may 
use:
 
c1 = IIf(Buy AND Ref(L,1) < 
Ref(O,1),1,0);
 
which disables all the Buy signals of which the low 
is equal to the open price when included in the PositionScore. For 
instance:
 
PositionScore = (50-StochK(8)) * c1;
 
During backtesting problems arise because 
in the backtest it removes Buy entries and replaces them with others while in 
practise I would enter for instance 5 limit orders of which maybe only 4 will be 
executed. I will not be able to add a 5-th entry later since I will never know 
if my limit order already in place will be executed or not..
 
The situation when sorted according to (50 - 
Stoch(8)) .    I may enter the top 5 signalsBuy 1: L 
< O, will likely be executed at the open priceBuy 2: L < O, will 
likely be executed at the open priceBuy 3: L < O, will likely be executed 
at the open priceBuy 4: L = O, will NOT likely be executed at the open 
priceBuy 5: L < O, will likely be executed at the open priceBuy 6: 
falls outside the top 5Buy 7: falls outside the top 5Buy 8: falls 
outside the top 5Buy 9: falls outside the top 5Buy 10: falls outside the 
top 5
 
when I superpose: (50 - Stoch(8)) * c1 then Buy 4 
will be 0 and Buy 5 will move in position 4 and Buy 6 will move to position 
5.
 
What I want is that Buy 4 is removed and so I enter 
only 4 new positions. Therefor Buy entry 6 will not be used instead of 
4.
 
so the the Question is:I want 
the backtest to chose the top entry signals but remove the ones 
of which Ref(L,1) == Ref(O,1) and NOT fill in this void. This 
will approach what is feasable in practise pretty close (at least for the 
entry..... I have a follow up question for the exit later...) and slippage may 
be ignored.
 
Is there an AFL trick I can use to do this? Please 
don't come with remarks that this is looking in the future because this is part 
of the idea. Since by looking in the future I am able to remove Buy signals that 
are very unlikely to be executed in the backtest. In reality I will send these 
LIMIT orders to my broker but since they will not be executed anyway I get the 
same result as the backtest will give me.
 
thanks, Ed


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

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.