PureBytes Links
Trading Reference Links
|
You would need to use Custom Backtester Rotational Mode. CBT low level objects and functions have more control over how to interpret position scores. See my previous post at:
http://finance.groups.yahoo.com/group/amibroker/message/99785
----- Original Message -----
From: Ken Close
To: amibroker@xxxxxxxxxxxxxxx
Sent: Monday, September 18, 2006 1:52 PM
Subject: [amibroker] Rotational Trading Question
I have searched past messages to no avail (or else I just can't see the answer), but can someone help with this or point me towards an example:
I am trying to use Rotational Trading with a general market signal. It works but I want to be able to hold open positions when the market signal goes on a sell, and control the sell via a trailing stop.
The market signal buy tells the code to buy the top three ranked by UPI.
The market sell signal should tell the code not to buy any new positions but sell the open positions only when the trailing stops are hit.
Right now, the code sells all positions when the market signal goes on a sell, rather than using the trailing stop code.
I have tried ApplyStop and it works correctly but only when the market signal is on a buy; all positions are sold when the market signal goes on a sell.
Here is the relevant PositionScore statement that must be foiling things here.
PositionScore = IIf(BuySig == 0 OR SellSig2 == 1, 0, IIf(Name() == "UAPIX", 999, Nz(UPI + 500)));
Setting Position Score = zero, as when the Buy Sig goes to zero or a special sell signal is activated, takes out open positions, which is what the problem is.
But I am unable to see a way to "gate" the buys with BuySig == 1 and prevent new buys if BuySig==0 and still get things to work.
Any suggestions on this one??
Thanks,
Ken
|