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

[amibroker] exiting flat positions



PureBytes Links

Trading Reference Links

Obviously, losses are a problem. But so are positions that hang in there
forever taking up available cash but going nowhere, without hitting profit
targets or stops.

How would you code that, assuming you're dealing with a system that tries to
dump losers but let winners run as long as they're advancing.

I tried starting from a modest stoploss, with the stop percentage advancing
every day until it becomes negative, enforcing the requirement to make a
profit or get off the bus. I'm not certain, but I think it's working, just
not very profitable in the context I tried it:.

Here's the code:

----------------
bars_since_buy = NZ(BarsSince(buy), BarCount);
bars_since_short = NZ(BarsSince(short), BarCount);
bars_since_entry = IIf(bars_since_buy < bars_since_short, bars_since_buy,
bars_since_short);
stoploss_rise = Optimize("stoploss rise", .5, .1, 1, .1);
stoploss = 13 - (stoploss_rise * bars_since_entry);
ApplyStop(stopTypeLoss, stopModePercent, stoploss, false, true, 0);
----------------

Anyone see any problems with the implementation? Any other ideas for
avoiding sitting in stagnant positions?

Dave


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/