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

Re: [amibroker] On Scalar Values and Arrays



PureBytes Links

Trading Reference Links

highestsince creates an array of values and if you explore from the
bar that buys then you will get the value of highest as calculatd for
every bar. As the price increases so the highest changes

It sounds like you are exploring over the range of the trade, and
wanting to see into the future to determine the highest high, when you
are exploring on te bar of the buy. For this you need to look into the
future and something like valuewhen to a future event to then look
back to find the highest is what is needed.

--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


On 4/10/06, Jeff Springer <fatboycato@xxxxxxxxx> wrote:
>
> Hi Steve,
> Thank you for responding. Unfortunately, that very straightforward and
> intuitive solution doesn't seem to work. It appears to be returning the high
> of the day after the signal. That's probably a result of the way I have
> "Buy" defined. My "Buy" is defined to tell me the day after the signal day.
> Here's the code:
>
> VolFilter=Ref(V,-1)>5*Ref(MA(V,50),-1) AND Ref(MA(V,50),-1)>=100000;
> PriceFilter=Ref(C,-1)>Ref(O,-1) AND Ref(C,-1)>1 AND Ref(C,-1)>Ref(C,-2) AND
> Ref(O,-1)>Ref(C,-2);
>
> Filter=Volfilter AND PriceFilter;// AND FundFilter;
>
> MaxHigh=HighestSince(Filter,High);
> PeriodstoMaxHigh=BarsSince(Filter)-BarsSince(MaxHigh);
>
> I think that, because HighestSince() is an array, I would have to reference
> some part of the array; thus the use of LastValue().
>
>
> Steve Dugas <sjdugas@xxxxxxxxxxx> wrote:
> Hi - Wouldn't something like this work?
>
> MaxHigh = HighestSince( Buy, High );
> BarsToMaxHigh = BarsSince( Buy ) - BarsSince( MaxHigh );
>
> Steve
>
> ----- Original Message -----
> From: "fatboycato" <fatboycato@xxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, April 09, 2006 12:50 PM
> Subject: [amibroker] On Scalar Values and Arrays
>
>
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
> ________________________________
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> countries) for 2¢/min or less.
>
>
>
>
> Steve Dugas <sjdugas@xxxxxxxxxxx> wrote:
> Hi - Wouldn't something like this work?
>
> MaxHigh = HighestSince( Buy, High );
> BarsToMaxHigh = BarsSince( Buy ) - BarsSince( MaxHigh );
>
> Steve
>
> ----- Original Message -----
> From: "fatboycato" <fatboycato@xxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, April 09, 2006 12:50 PM
> Subject: [amibroker] On Scalar Values and Arrays
>
>
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
> ________________________________
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> countries) for 2¢/min or less.
>
>
>
> 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
>
>  Visit your group "amibroker" on the web.
>
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
> ________________________________
>
>
> ________________________________
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/