PureBytes Links
Trading Reference Links
|
Tomasz wrote:
> ExRem helps only if you already have a sell rule.
> In other cases (when you want for example to sell after N-days)
> you should use ExRemSpan.
Thanks, Tomasz. I'll use that technique from time to time.
However, it does not accomplish exactly what I had in mind.
What I am trying to do is something like:
Buy=C > Ref(C,-1); /*or whatever*/
Sell=BarsSince(Buy) > K AND [Some other rule]
Of course, the BarsSince() number gets reset every time a new bar
fits the Buy criteria. That can be useful; I've run into cases where
BarsSince(LastOccurrenceOfABuySignal) produced nice profits,
which could be collected in actual trading. However, for some
techniques, and for analytical rigor (to the extent that I am capable
of rigor other than mortis), we need to count the delay from the
entry bar. I have tried
BuyBar=IIf(C > Ref(Buy Criteria,1,-1);
Sell=BarsSince(Cross(BuyBar,0)) > K AND ...
but found circumstances where it didn't work. (None of them
leap to mind at the moment. I had not fought with this in a while
and remembered the problem only when playing with the new
beta yesterday.)
The obvious application for this is in testing breakout techniques,
where some "experts" call for a delay before the exit criteria
take effect. However, it would be useful in testing many short-term
trading methods.
My best thought so far is to do something like:
Buy=BuyRule;
Sell=SellRule;
Buy=ExRem(Buy,Sell);
Temp=Sell;
Sell=BarsSince(Buy) > K AND Temp;
I haven't tried it yet, as it occurred to me only while writing
this note. Does it make sense?
Even if it works, it would be a lot easier to have Amibroker
take care of the bookkeeping and just write BarsSince(Entry).
Any thoughts?
Thanks.
Owen
|