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

Reply via email to