Run it on a plot and you will see that it works.
Bill
----- Original Message -----
From: Edward Pottasch
To: [email protected]
Sent: Friday, March 23, 2007 9:33 AM
Subject: Re: [amibroker] Re: Hold and Valuewhen functions
i would be interested to see if you can reproduce the result I posted earlier
using your solution. I do not see how.
rgds, Ed
----- Original Message -----
From: wavemechanic
To: [email protected]
Sent: Friday, March 23, 2007 1:41 PM
Subject: Re: [amibroker] Re: Hold and Valuewhen functions
How about something like this for the array route:
setup = cross(bbandbot( c, 20, 2), c);
wait = iif(barssince(setup) < 6, 1, 0);
Bill
----- Original Message -----
From: Edward Pottasch
To: [email protected]
Sent: Friday, March 23, 2007 4:26 AM
Subject: Re: [amibroker] Re: Hold and Valuewhen functions
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 -----
From: bernardedmond01
To: [email protected]
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
--------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.14/727 - Release Date:
3/19/2007 11:49 AM
------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.14/727 - Release Date: 3/19/2007
11:49 AM