Set stop at low of entry bar

Hi everyone, new to AB and figuring out some basics and stuck on something which I'm sure is simple.

I wanted to set a sell stop at the low of the bar on which the long signal was generated. I used portions of the code found here:

It works! However, I do not understand why. Specifically the line:

stopLevelLong = Ref( L, -1 ); // use previous bar low

Is that not creating an array? How is the value of "stopLevelLong" only being set on the bar of the buy signal?

On a related note, if I could visualize the arrays, it might be helpful. Is there a way to view the arrays in a data window?


Yes it creates array, but... ApplyStop() samples the value of the array passed as 'amount' at entry and holds it for how long trade takes, unless you use volatile flag.

Visualising arrays and other techiques:

See also:


You can use the explore function. Think that is what you are looking for....

1 Like

Yes, got that, thanks!

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.