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

[amibroker] Re: Counting buy and sell signals



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Andrew Smith" <andy_kovacs@xxxx>
wrote:
> Hi folks ...
> 
> Does anyone know how to write a simple code that does the following:
> 
> Keeps a count of how many consecutive buy (short) signals are
generated in a share, but resets to zero when:
> 1) a short (buy) signal is received or,

Buy  = ...;
Sell = ...;

isLong = Flip(Buy,Sell);
countBuy = IIf(isLong,Sum(Buy,BarsSince(isLong),0));


> 2) when "x" consecutive buy (short) signals have been counted or,

more_Than_X_Buys = countBuy > "x";

> 3) when a sell (cover) from a sell (cover) condition or an
applystop is received.

sell_from_applystop = IIf(Sell>1, True , False);


(I did not test the code.)

for short positions vice versa.

HTH

Stephan



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/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/