PureBytes Links
Trading Reference Links
|
Conditions are true or false.
AFL conditions are also true or false.
AFL conditions are equal to 1[true] or 0[false].
The value of a
Cond=...
array will be, for example,
...,1,0,0,1,0,0,1,1,0,...
If a condition is true *only once* the last 5 bars then the value
will be
1,0,0,0,0
or
0,1,0,0,0
or
0,0,1,0,0
or
0,0,0,1,0
or
0,0,0,0,1
There are many ways to express this fact in AFL.
Here is a short one
Cond=...
Last5bars=Sum(Cond,5)==1;
If the condition is true *at least once*, then
Cond=...
AnyoftheLast5bars=Sum(Cond,5)!=0;
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "bflori" <bflori@xxxx> wrote:
> I want to create a line of code that says "if a condition is true
in
> any of the last 5 days".
>
> For instance, if a 17/30 sma crossover occurs AND IF STOCH K IS
> BELOW 30 IN ANY OF THE LAST 5 DAYS,then Buy. Or simply screen for
> stocks where this dual condition is present.
>
> Any suggestions on how I write this "last 5 days condition"?
>
> Many thanks to you gurus.
>
> bflori@xxxx
------------------------ 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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|