Here is the code for what I meant to do.
It plots the difference between the price and a moving average as an oscillator. It looks very similar to an RSI...
//+------------------------------------------------------------------+
//| MApricediff.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp.|
//|
Forex Trading Software: Forex Trading Platform MetaTrader 4 |
//+------------------------------------------------------------------+
// indicator based MAdistance.mq4 by Tim Hyder aka Hiachiever
//
http://www.forex-tsd.com/blogs/newdi...ce-itself.html
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Black
#property indicator_level1 0
extern int MA.Period = 10;
extern int MA.Method = MODE_SMA;
extern int MA.Price = PRICE_CLOSE;
extern int MA_Shift=0;
extern bool UseTickdata = True;
double diff[];
int init()
{
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,diff);
return(0);
}
int start()
{
int MA.Shift = 1;
if(UseTickdata) MA.Shift = 0;
for( int i = Bars - IndicatorCounted() - 1; i >= MA.Shift; i-- )
{
double MA = iMA(Symbol(),Period(),MA.Period, 0, MA.Method, MA.Price, i);
diff[ i ] = (Close[i] - MA)/Point;
}
return(0);
}