Thanks graham,
In the example below, how would I use ValueWhen if I wanted
to calculate the pct change of the closing price between a buy and a sell
instead of N days later?
N=10;
//only set if it's the first time RSI crosses threshold, otherwise
set to 0
bArray = cross( ema( C,
12 ), ema ( C,26 ) );
sArray = cross( ema( C, 26), ema ( C, 12 ) );
Buy = bArray ;
Sell = sArray;
PctChg = ( Ref( Close,
N ) - Close ) / Close * 100;
AddColumn( C , "Close", 1.2 );
AddColumn( PctChg, "% Price Chg", 1.2, IIf( PctChg < 0, colorRed,
colorGreen ) );
Filter = bArray;
Thanks Much.
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Graham
Sent: Friday, March 10, 2006 6:00 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Pct Change in Exploration
use valuewhen to refer to values at a specifc event like buy
--
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 3/11/06, dimension@xxxxxxxxxxxxx <dimension@xxxxxxxxxxxxx>
wrote:
>
>
>
> I have a system that that gives a BUYS based on some indicator
readings and
> SELL based on other indicator readings.
>
> Works great as a back test. I'd like to convert this to an
exploration but
> the difficulty I am having is figuring out how to calculate the
percentage
> change between the buy and sell signals. Typically in
explorations I do
> something like this to calculate the percentage change array based
on a
> Fixed number of bars, N.
>
>
PctChg = ( Ref( Close, N ) - Close ) / Close * 100;
>
>
>
> How do I do the samething based on Buy and Sell arrays? Is
there away for a
> given Buy, to get the bar at which the Sell occurs?
>
>
>
> 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.
> 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.
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
> ________________________________
>
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/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/