Ed, I can't get your attachements. They show at the bottom of the message but also say "not stored", and there's nothing to get. Any idea why that might be (it seems to be the same for all messages with attachments here)?
I looked back at the original discussion, and from what it seems like the objective is to me, I think the whole thing can be done like this: Setup = ExRemSpan(C < BBandBot(C, 20, 2), waitPeriod-1); SetupPrice = ValueWhen(Setup,H) * triggerPercentage; Buy = Cross(H, SetupPrice) && BarsSince(Setup) < waitPeriod; All that loop code can be replaced by the ExRemSpan array function. Also, in that original loop code, there are a couple of problems. Firstly, it skips a bar at the end of each inner loop, because the statement i=j sets i to the next bar, but then the for loop's i++ statement increments it straight away. It should be i=j-1. Secondly, it won't run to the end of the array. The outer loop's condition should be i < BarCount but then the inner loop needs to add "AND j < BarCount" to its condition to avoid over-running the array. Regards, GP
