Thanks Ed,
Looping was my next step, but I was hesitant because of the extra time
it takes ...
Got my code working with Ed Pottasch's encouragement to stay with
ValueWhen).
Ara
On 08/15/2010 9:05 AM, Ed H wrote:
Ara,
I have done something similar, but different, using static variables.
with the result at each bar being loaded into a static var with the
pseudo code looking something like:
For(i = 0; i < barcount , i++)
{
stoc_low[i] = "some calculation result"
varset("Rank" + i, stoc_low[i]);
}
Now you have all of the ranks as separate RankNNN vars.
Then you can iterate through the RankNNN list (using VarGet) and do a
sort routine (look in the library for an example sort)
then pick the top xxx of the resulting sorted list.
Kinda messy, but do-able,
Ed
--- In [email protected] <mailto:amibroker%40yahoogroups.com>,
Ara Kaloustian <ara1.kaloust...@...> wrote:
>
> Having a lot of trouble with some array processing.
>
> I want to compare the low points of a stochastic.
>
> I define the reversal points as
> Trough_Def = StocK > Ref(StocK,-1) AND Ref(StocK,-1) < Ref(StocK,-2);
> shift the array by one bar
> Stoc_Low = Ref(Trough_Def,1);
>
> So far so good.
> Now I want to know which low points are higher than prior low. This is
> easy to do for the last two lows (or any two lows from the selected
> bar), but I can't figure out how to create an array with that info for
> the entire data set, so it can be used for backtesting.
>
> Thanks in advance
>
> Ara
>