Thanks Mike, You've been a great help, and this might be my new mantra, "Everything is an array in AB!"
And it's just test code so I can learn how and why AB does what it does, so I'm not real concerned about CPU cycles or code efficiency per se. The looping also solved the chicken and egg problem of knowing the last Sale bar to initiate the next Buy without having had a Buy already. (Not that there probably wasn't another higher level way of doing that and then using ApplyStop :) Best, Michael --- In [email protected], "Mike" <sfclimb...@...> wrote: > > Both BuyPrice and SellPrice are arrays. You must use an index into them when > assigning values, else the same value will be set for all bars. > > e.g. > > SellPrice[i] = stopLoss; > > Also, have a look at the ApplyStop function. Your entire example can probably > be written in 3 or 4 lines using ApplyStop instead of doing all that looping. > > http://www.amibroker.com/guide/afl/afl_view.php?id=20 > > Mike >
