PureBytes Links
Trading Reference Links
|
Hello:
Fairly new to Amibroker with a question regarding MA crossover. This is probably very simple to code, but I can't seem to wrap my head around it. I would like to have a filter that I include with buy logic as follows: Using S&P500 data, whenever price moves above 65 week moving average by 1%, filter = 1. Whenever price moves below MA by 1% filter = 0.
The part I'm getting hung up on is what happens in between filter. Say price trends down from buy zone (1.01*65 week MA), but doesn't close below sell zone (.99*65 week MA). Then price comes back up above 1% buy filter. During this period, the filter should always = 1. But if it crosses 1% sell filter, it should become 0 until it crosses above 1% buy filter.
I think I'm making this much more confusing than it needs to be. I'm sure there is a very simple way to program this - that's what I'm looking for.
Thanks ahead of time,
Levi
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|