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

[amibroker] ApplyStop question



PureBytes Links

Trading Reference Links

Hi, all: Last night I had a mind warp about a very simple stoploss I wanted to code, but for some silly reason, I failed. All I want to do is set a max stoploss to sell my long position if the price declines below the low of the day before the entry. Here is how I coded it: Stoploss=BuyPrice-ValueWhen(ref(Buy,-1),L);//sets distance in pointsApplyStop(0,2,stoploss,1); Problem is when I look at the trade list in the AA window, I see lots of exits labeled 'max loss' but the result was a profit!! Obviously, you can't have a stoploss resulting in a profit, so obviously something is wrong with the StopLoss statement above. Should it be: StopLoss=BuyPrice-ValueWhen(Buy,ref(L,-1)); ? Or should it be something entirely different? Thanks. Al Venosa Al Venosaavcinci@xxxxxxxxxxx The new MSN 8: smart spam protection and 2 months FREE* Yahoo! Groups Sponsor ADVERTISEMENT 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 the Yahoo! Terms of Service.