Hi - Have a look at the Flip() function, once price enters your buy zone it can return a 1 until it enters your sell zone.
Steve ----- Original Message ----- From: "levibreidenbach" <[email protected]> To: <[email protected]> Sent: Friday, October 16, 2009 4:47 PM Subject: [amibroker] MA cross with %filter > 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 > > > >
