Hi there, I've been studying AmiBroker for nearly a year now, and I think am in a situation where I NEED to use an if statement (not IIf).
My formula identifies a SpecialCase as an event when price hits my prescribed LimitEntryPrice AND the MissedTheBoatPrice in a single bar. So you get a signal, then the next bar you want to enter. However, if price goes up and hits your target before entry, then it invalidates the signal. You missed the boat.
IF the special case occurs, I then use TimeFrameSet/Restore/Expand to drill down into that bar (from a 15-minute bar to a 1-minute bar) to determine white price level, LimitEntryPrice or MissedTheBoatPrice, was hit first.
IF the special case does not occur, then I do not want to waste system resources (time) to drill down into the 1-minute time frame. I've tried this approach already, and my system grinds to a crawl when scrolling through the chart. I only want to drill down into that time frame when it's required.
My challenge: SpecialCase returns as an array. I need a numeric or Boolean value to control the if statement. What are my options with respect to pulling the value of SpecialCase bar out of the array and storing it into a numeric or boolean variable (non-array)?
I keep going in circles using functions like BarCount, LastValue(), BarIndex(), ValueWhen().
BarCount is the total number of bars in my chart. LastValue() is the last value of SpecialCase in the chart, BarIndex(), I try to use that in SpecialCase[BarIndex()] , but it tells me I can only use a number as an index (BarIndex() is an array ). I tried ValueWhen(SpecialCase, BarCount) and that returns an array also.
AHHHHH this is probably the simplest thing in the history of things, but it's melting my brain! Help!!!
I can paste code if you guys need it, my real question is more focused on the "how do I get a number/Boolean for my if statement?"
Nathan.