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

Re: [amibroker] Re: Hold and Valuewhen functions



PureBytes Links

Trading Reference Links

hi, what the code below does: it calculates "Setup" which has a "1" where ever C closes below the BBandBOT. Then I subject the array "Setup" to the loop. When inside the "i" loop and it finds a "1" then it enters the "j" loop and will make a number of "waitPeriod" bars "0" that follow the "1" bar at bar "i". When finished with the "j" loop I tell it that i = j so that it enters the "i" loop at the value of "j" etc.
 
So basicly if a "1" is found in the array "Setup" it zeros out the next "waitPeriod" bars.  I do not know of an array based calculation in AFL that could do it more simple.
 
 
SetBarsRequired(10000,10000);

triggerPercentage =
1.03
;
waitPeriod =
15
;

Setup =
C < BBandBot(C,20,2
);

for (i = 0; i < BarCount
- waitPeriod; i++) {

   
if
(Setup[ i ]) {

      
for (j = i + 1
; j < i + waitPeriod; j++) {
      
         Setup[ j ] =
0
;
      
      }

      i = j;

   }

}
 
 
 
----- Original Message -----
Sent: Friday, March 23, 2007 1:26 AM
Subject: [amibroker] Re: Hold and Valuewhen functions

Edward
Would you mind translating into plain English the for - if loop
please? I've looked at the examples in the user's guide but I can't
follow the AFL.
Thanks

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___