| 
 PureBytes Links 
Trading Reference Links 
 | 
Mark Johnson,
Your post caught my attention.  I simplified the code (without changing the overall algorithm) in order to see what's really going on. This is what I got...
===========================================
vars: MP(0), osc(0);
MP = MarketPosition;
osc = ( close - Average(Close, 89) ) / xaverage ( truerange, 89.9 ) ;
if MP < 1 AND osc > 3 then Buy        at market ;
if MP = 1 AND osc < 0 then ExitLong   at market ;
if MP >-1 AND osc <-3 then Sell       at market ;
if MP =-1 AND osc > 0 then ExitShort  at market ;
============================================
The oscillator compares closing price to its simple moving average, and the difference is scaled by the average true range.  The result is compared to thresholds.
- Mark Jurik
 
 |