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

[amibroker] Looping - our previous discussion



PureBytes Links

Trading Reference Links

Ed
You assisted me with the following code (your code) on March 23rd. 
The background to our discussion was that I wanted to understand how 
to hold for a number of periods.
I wondered if I could ask you a couple of questions on your code (at 
end):

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; 

   } 

} 

 
1. Is it correct to refer to the j loop as being "nested" in the i 
loop? I'm wondering whether the j loop completes its internal loop 
for the 15 or so bars and then re-enters the i loop at the end or 
whether both i and j loops run the 15 or so times?

2. "i<BarCount-waitperiod" ? can you explain how the code translates 
that please? I thought that would have  meant you terminate once the 
current bar is less than the total number of bars less 15, whereas 
it seems to me an you terminate at 15.

3. You mentioned when we previously discussed this issue that Setup 
has a "1" wherever C < BBandBot. Is that why in other codes, 
sometimes the values of an array are set to 0 before a loop (to 
remove any previous arrays triggered)?

Thanks for your assistance,
Bernard




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
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/