[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Indicator help



PureBytes Links

Trading Reference Links

For anybody who may be interested...

I was intrigued by the concept of an "Oscillator Predictor" but I am limited by my Amibroker formula language (yet again!). I have no easy way to locate the 3 highest/lowest oscillator values over a 6 month period other than by eye-balling them and entering the values each time :-( ... and so I took a look at the detrended oscillator formula to see what I could do...

I decided to try and use a standard deviation of the detrended oscillator values over 6 months as a substitute for the manual approach (I use 2 standard deviations). Then, in order to get the predictor, I just solved the detrended oscillator equation for "close" and got:

//Oscillator Predictor

p = Param ( " Percent ", 100, 0, 100, 5 ) ;
Detrended = Close - MA (Close,7) ;
SDevNow = StDev ( detrended, 130 ) ; 

Overbought = ( Sum ( Close,6 ) + 7 * p/100 * 2 * SDevNow) / 6 ;
Oversold = ( Sum ( Close,6 ) - 7 * p/100 * 2 * SDevNow ) / 6 ;

Plot ( Overbought, _DEFAULT_NAME(), ParamColor ("color", Colorcycle ), ParamStyle("Style") ) ;
Plot ( Oversold, _DEFAULT_NAME(), ParamColor ("color", Colorcycle ), ParamStyle("Style") ) ;

translation: the sum of the last 6 closes (including today) plus 7 times a percentage of the max oscillator value you want, times 2 standard deviations of the detrended oscillator over the last 6 months, all divided by 6. whew!

Basically the equation gives you a value of tomorrow's close that will result in an oscillator value that is p% of the "max". I made "p" a variable so I could plug in 70, 80, 90, etc.

My problem is that I 'm not getting tomorrow's value.  Can anyone tell me what is wrong with my code?

Thanks

tony

 



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