Thread: How to code?
View Single Post
  #1871 (permalink)  
Old 06-30-2009, 11:34 AM
mladen's Avatar
mladen mladen is offline
Senior Member
 
Join Date: Oct 2006
Posts: 1,275
mladen is on a distinguished road
To smb1970 - this is it :
PHP Code:
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  Red
#property indicator_maximum 100
#property indicator_minimum   0

//
//
//
//
//

extern int    OscPeriod  8;
extern int    OscPrice   PRICE_CLOSE;

double oscBuffer[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   
SetIndexBuffer(0,oscBuffer);
   
IndicatorShortName("Osc ("+OscPeriod+")");
   return(
0);
}
int deinit() { return(0); }
int start()
{
   
int counted_bars=IndicatorCounted();
   
int i,limit;
   
   if(
counted_bars<0) return(-1);
   if(
counted_bars>0counted_bars--;
           
limit=Bars-counted_bars;

   
//
   //
   //
   //
   //
   
   
for(i=limiti>=0i--)
   {
      
double price iMA(NULL,0,1,0,MODE_SMA,OscPrice,i);
      
double high  High[ArrayMaximum(High,OscPeriod,i)];
      
double low   Low[ArrayMinimum(Low,OscPeriod,i)];
      
      
//
      //
      //
      //
      //

      
if (high!=low)
         
double raw 100.00*(price-low)/(high-low);
      else      
raw =   0.00;         
      
oscBuffer[i]= oscBuffer[i+1]*2.0/3.0 raw/3.0;      
   }
   return(
0);

But, take a look at the picture too : upper is "Oscar" lower is Ema(5) of stochastic(8), or to make it even simpler, on the bottom is Stochastic(8,5,1) with signal line set to exponential. So "Oscar" is simply a signal line of the stochastic
Attached Images
File Type: gif oscar.gif (20.5 KB, 76 views)
Reply With Quote