PureBytes Links
Trading Reference Links
|
Hi Stan,
% is the modulus operator. A = B % C
says that A = the remainder when B is divided by C
I think you can find it in the AFL Reference Manual
in the help files.
"anything % 2 == 0" can
be used to separate the evens from the odds, as I did
below.
In the code below, each even numbered occurance of
BUY (remainder == 0) is assigned to the sell array. Then the buy array is
redefined to hold only the odd numbered buys.
I think you will find that it buys on the 1st buy
signal (and all other odd numbered buys) and sells on the even numberd buys (in
the original buy array). Please see the attached picture. Try setting AA to all
quotes and "filter = 1;"
Steve
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
sjsolak
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, October 01, 2003 12:59
PM
Subject: Re: [amibroker] SPX Buy and Sell
Signal
Steve,
Thank you. This is very close to what I
want. The small problem is that it starts to buy on the 2nd event
and then sell on 3rd, etc. I would prefer buy on 1st and sell on
2nd. Other then that small problem, this is great.....
I am trying to learn and understand
Amibroker. I tried to look up what the % 2 is doing. Could not
find anything on this. Probably looking in the wrong place.
Doesn't seem to be in the help doc's.
Thanks again.
Stan
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Steve
Dugas
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, October 01, 2003 11:42
AM
Subject: Re: [amibroker] SPX Buy and
Sell Signal
Hi Stan - how about something like
this?
fast=5;slow=6;
FstC=EMA(C,fast);SloC=EMA(C,slow);Cond1 =
Cross(FstC,SloC);
Buy= Cond1;Buys = Cum( Buy );Sell = Buy
AND Buys % 2 == 0;Buy = Buy AND NOT Sell;
Filter=
C>1;AddColumn(Buy,"Buy");AddColumn( Buys,
"buys");AddColumn(Sell,"sell");AddColumn(FstC,"Fast
C");AddColumn(SloC,"Slow C");AddColumn(Cond1,"C Gt
Av");
Steve
Send BUG REPORTS
to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT<img
src="" width=300 height=250 border=0>
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.
Attachment:
screenshot1.png
Attachment:
Description: "Description: PNG image"
|