[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] On Scalar Values and Arrays



PureBytes Links

Trading Reference Links

Well, I'm about to put on my clown suit, get my AK-47, and climb the 
bell tower. It seems to me there is a legitimate reason to reference 
a particular value in an array in explorations. I'll try to give a 
specific example to exactly what I'm searching for, but I think this 
array-to-scalar problem is going to plague me everywhere.

Trading System:
Buy on the open the day after a high volume gap up.
Analysis questions:
1) What is the maximum high the stock attained after the signal day, 
and how many days did it take to get to the maximum high?
2) What is the minimum low the stock attained after the signal day, 
and how many days did it take to get to the minimum low?

I'm having no problem identifying the signal day, it's finding the 
data to answer the questions where I fail. I can get the answer to 
question number one with:
MaxHigh=LastValue(HighestSince(Filter,H,1),1);
PeriodstoMaxHigh=(BarCount-LastValue(HighestSinceBars
(Filter,H,1),1))-BarIndex()-1;

But this makes the assumption that a stock will always go up 
because "LastValue()" only looks at the last occurence when the 
criteria were satisfied. An assumption I could probably live with, 
but there should be a better way of doing this.

Regardless, this solution doesn't work for finding the answer to 
Analysis question #2 because, again, LastValue() only looks at the 
last time the criteria were met. Therefore, the MinLow is going to 
be the lowest value the stock attained after the last signal day.

I thought I could put in a loop to iterate through each successive 
day after each signal day and check if it's making higher highs or 
lower lows - no luck. Ref() is an array, SelectedValue() is the last 
occurence, ValueWhen() is an array, can't use High[] because I won't 
know what goes between the brackets because, even though I can get 
AA to return the correct barindex, BarIndex() is an array.

I'm sure there's something easy I'm missing because closing a 
position based on yesterday's levels is a fairly common exit 
strategy (isn't it?). Wouldn't AB be able to compare today's prices 
against yesterday's prices and decide if they're higher or lower?

Thank you in advance for any help you can give.

Jeff






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

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/