PureBytes Links
Trading Reference Links
|
Tomasz Janeczko wrote:
>You can use ExRemSpan instead: (etc.)
>
I could again go over why this doesn't work?
Please trace through the logic of what happens when ExRemSpan lands you
on another day when the Buy conditions are true.
For example--the example I used maybe two weeks ago--take the classic
Larry Williams system with a volatility-breakout entrance and his
"bailout" exit: Enter when today's High is higher than the Open plus
(some fraction of) yesterday's range. To get out, wait one bar, to give
the price time to move, and Sell on the first profitable Open. Use a
stop-loss to escape the losers. So:
Buy=H > O + Ref(H - L,-1);
BuyPrice=Max(O, Ref(H - L,-1) + TickSize);
Sell=BarsSince(Entry) > 1 AND O > Ref(C,-BarsSince(Entry));
SellPrice=O;
//And the obvious equivalents for Short trades
ApplyStop(0,2,PickANumber,1,False);
Those of you who once used Metastock will remember BarsSince(Entry),
probably with great fondness and regret. But you can't do that in AFL.
You can't even do separate BarsSince(Buy) and BarsSince(Short)
statements. In AFL, your Sell statement becomes Sell=O >
ValueWhen(Buy,BuyPrice,1); And when you try to use ExRemSpan, there is
every chance that you will land on another day where the Buy conditions
are true. At which point the ValueWhen function looks at that day's
BuyPrice, and O is never higher.
For a one-day delay, we can write two sell conditions, one for use if
today is a Buy day and one for use if it is not, with different numbers
for the third parameter in the ValueWhen statement. But what if you'd
like to set the delay for more than one day? How many Sell conditions
do you have to write to take care of all the possible combinations of
Buy and non-Buy days since the entry?
Two very talented programmers from our group were kind enough to attempt
solutions to this problem for me, one in AFL, the other in ... I guess
that was jScript. I am very grateful to them for trying. However,
neither succeeded. In each case, trades that should have ended with a
profit after two or three days were not exited until much later. In a
test of the AFL version on continuous S&P data, the average trade length
was just over 46 bars, and one trade lasted more than 600 bars!
This is a very simple system, one of the most famous in all of
traderporn. It can be "coded" unambiguously in English. With
BarsSince(Entry), it could be coded unambiguously in Metastock; but MS
would not give you valid entry and exit prices when I used it last; that
was a major reason I was delighted when Tomasz made Amibroker
available. Unfortunately, one really useful thing from Metastock got
left behind. I understand that there are reasons for this. But those
reasons are keeping me from testing this and several other ideas that
might be of value. Or they might not. At this point, I have no way to
know.
I am profoundly sorry to keep pushing this, as I believe Tomasz created
ExRemSpan in response to one of my early pleas for help in coding this
exit. And it could be that there is some way to use ExRem and ExRemSpan
that actually solves the problem with the kind of generality I'm looking
for, a technique that Tomasz knows but neither I nor my Samaritans were
able to recognize. But I'm betting against it.
I have been trying to solve this problem for more than two years and am
quite convinced that it cannot be done. Tomasz, PLEASE HELP.
Pretty please? I'll finally get around to renewing my license if you
do. 8-)
Thanks to all for bearing with me on this.
Owen Davies
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/
|