PureBytes Links
Trading Reference Links
|
How about this more intuitive code (for me and maybe for most others) by
using Hold instead of Sum. I think Hold is also more efficient than Sum as
it works using boolean calculation rather than arithmatic.
Buy = MA(C,25)>MA(C,75) AND ( NOT Ref(Hold(MA(C,25)>=MA(C,75),10),-1));
Here you are checking in the second condition that the MA25 was not greater
or equal to MA75 over any of the past 10 days.
Note the use of NOT on the Hold. This will help in similar examples where
you want to have a specific condition true over some past few bars. Then
what you have to do is deduce the exact complement or opposite condition and
put it into Hold , go back as many bars as you want (use Ref) and then NOT
it.
-Ajay
----- Original Message -----
From: "ldriker" <leoker@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, July 01, 2005 2:52 AM
Subject: [amibroker] A More Efficient Way?
> Following is a simple buy signal premised upon the 25 day simple
> moving average just having crossed above the 75 day simple moving
> average coupled with the 25 day simple moving average being below
> the 75 day simple moving average for each of the last 10 days.
>
> How might this code be written more efficiently?
>
> Buy = MA( Close, 25 ) > MA( Close,75 ) AND
> MA( Ref( Close, -1 ), 25) < MA( Ref( Close, -1 ), 75 ) AND
> MA( Ref( Close, -2 ), 25) < MA( Ref( Close, -2 ), 75 ) AND
> MA( Ref( Close, -3 ), 25) < MA( Ref( Close, -3 ), 75 ) AND
> MA( Ref( Close, -4 ), 25) < MA( Ref( Close, -4 ), 75 ) AND
> MA( Ref( Close, -5 ), 25) < MA( Ref( Close, -5 ), 75 ) AND
> MA( Ref( Close, -6 ), 25) < MA( Ref( Close, -6 ), 75 ) AND
> MA( Ref( Close, -7 ), 25) < MA( Ref( Close, -7 ), 75 ) AND
> MA( Ref( Close, -8 ), 25) < MA( Ref( Close, -8 ), 75 ) AND
> MA( Ref( Close, -9 ), 25) < MA( Ref( Close, -9 ), 75 ) AND
> MA( Ref( Close, -10 ), 25) < MA( Ref( Close, -10 ), 75 )
>
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
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/
|