//+------------------------------------------------------------------+
//| PSO.mq4 | copyright Bolt Systems 2007
//| Copyright © 2007, MetaQuotes Software Corp. |
//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- input parameters


extern int lag =10;  //should really be left alone.

//For use on 15 mins euro chart only. 
//Anything else has not been modelled! The wights are good for about 30 days without retraining.

//time regression wieghts 




extern double m1=  1.264969979;
extern double m2=  -0.3186370742;
extern double m3= -0.02074919458;
extern double m4=  2.018156799;

//---- buffers
double out[];

int i = 0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,out);
   SetIndexLabel(0,"out");  
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   limit = 1000;

   for(i=0; i<limit; i++)

     
      { 
      out[i]= m1*MathPow((iOpen(NULL,0,i+lag)+m2),MathPow(iHigh(NULL,0,i+lag),m3))/ MathPow (MathSin(iLow(NULL,0,i+lag)),m4);
      }
      
              
      
return(0);
}


//+------------------------------------------------------------------+