PureBytes Links
Trading Reference Links
|
Thank you so much for replying, Bill, but I don't think that will work for me. I was hoping to use the code in an exploration, and I think this code will only give me the data in a debugger window, correct? I tried assigning the _Trace calls to variables, and then displaying that variable with AddColumn, but of course that doesn't work. I'm too programming ignorant to know why. It seems to me that if Ref() calls up a specific value in the array, then it shouldn't be returning an array, just that specific value. I'm sure there's a good reason why it doesn't work this way, I only wish I had some way of calling up a value from an array and assigning that value, and only that value, to a variable.
Bill Barnard <wbarnard@xxxxxxx> wrote: Try
this:
//--------------------------------------------- DN = DateNum();
for (i= 0; i < BarCount - 1 AND Close[i]== Close[0]; i++);
_TRACE("firstDifferent = " + Close[i]); _TRACE("DateNum = " + DN[i]);
//----------------------------------------------
Bill
--- In amibroker@xxxxxxxxxxxxxxx, "fatboycato" <fatboycato@xxx> wrote: > > Well, I'm stumped. I've tried just about every way I could think of > to get this accomplished, but I'm simply not smart enough to do it. > Hopefully, someone here is. > > I can't seem to iterate through an array to discover if a value is > different from a base value. For example: suppose your array looks > like this: > 0,0,0,0,0,0,0,0,1,1,1,1,1 >
> I want to look through that array and return "1" the first time it > changes from 0 to 1. The problem is that arrays can't show up in any
> kind of loop. I don't know the 1 is there, so I can't just look > for "1". I need to look through the array and return the different > value, whatever it may be. > > Here's an example of what the code would look like: > > I have an array. > Look at the first number in the array and call it "x". > Look at the second number in the array. If it's the same as "x", > then look at the third number. If it's still the same, look at the > fourth number, etc... > Once you get to a number that is not "x", call that number "y". > Stop looking for something other than "x". > > Any ideas? The Ref() function obviously won't work because it > returns an array. Is there another function that works like Ref(), > but returns a single value? >
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
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 other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|