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

Re: [amibroker] Looping - our previous discussion



PureBytes Links

Trading Reference Links

hi Bernard,
 
I have adjusted your idea a little. Also Amibroker came with some enhancements in the mean time.  Have a look.  Also for Bill (wavemechanic) who says this can be easily done with arrays only maybe he can give an example that works. I will think about an array solution later as well.
 
Like you asked the trigger is when C is lower than some area defined by the Bbands. Then if within a wiat period the price breaks through a certain defined thershold it will buy. Else it will do nothing as illustrated in the chart.
 
About your questions. Best have a look at the adjusted code and see if you understand this better. If you have other intersting ideas let me know and I will try to code it.
 
rgds, Ed
 
 
 
 
----- Original Message -----
Sent: Friday, June 15, 2007 5:51 AM
Subject: [amibroker] Looping - our previous discussion

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





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

__,_._,___

Attachment: Description: Binary data

Attachment: bern.png
Description: PNG image