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
 
 
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html






SPONSORED LINKS
Software support Small business finance Business finance online
Business finance training Business finance course

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to