OsUSD





//+------------------------------------------------------------------+
//|                                                        OsUSD.mq4 |
//|                                                      Raymond Toh |
//|                                           http://forex.eazel.com |
//+------------------------------------------------------------------+
#property copyright "Raymond Toh"
#property link      "http://forex.eazel.com"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue

double Signal_Up[];
double Signal_Down[];
double USD_Index[];

extern int MA_Period=12;
extern int MA_Shift=5;
extern int Price=6; //Weighted close price, (high+low+close+close)/4.
extern int Mode=3; //Linear weighted moving average.

int init()
  {
   
   IndicatorShortName("OsUSD("+MA_Period+","+MA_Shift+","+Price+","+Mode+")");
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(0,Signal_Up);
   SetIndexLabel(0, "Signal_Up"); 
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(1,Signal_Down);
   SetIndexLabel(1, "Signal_Down"); 
   SetIndexBuffer(2,USD_Index);
   SetIndexLabel(2, "USD"); 
   return(0);
  }
int deinit()
  {
   return(0);
  }

int start()
  {
     int limit;
     int counted_bars=IndicatorCounted();
     if(counted_bars<0) return(-1);
     if(counted_bars>0) counted_bars-=1;
     limit=Bars-counted_bars;
     

     for(int i=0; i<limit; i++)
       {
        USD_Index[i]=
            (iMA("EURUSD",0,MA_Period,0,Mode,Price,i+MA_Shift)-
            iMA("EURUSD",0,MA_Period,0,Mode,Price,i))*10000
            +
            (iMA("GBPUSD",0,MA_Period,0,Mode,Price,i+MA_Shift)-
            iMA("GBPUSD",0,MA_Period,0,Mode,Price,i))*10000
            +
            (iMA("USDCHF",0,MA_Period,0,Mode,Price,i)-
            iMA("USDCHF",0,MA_Period,0,Mode,Price,i+MA_Shift))*10000
            +
            (iMA("USDJPY",0,MA_Period,0,Mode,Price,i)-
            iMA("USDJPY",0,MA_Period,0,Mode,Price,i+MA_Shift))*100
            ;
            
            if (USD_Index[i]>= 0){ Signal_Up[i] = USD_Index[i]; Signal_Down[i] = 0; } 
            else { Signal_Down[i] = USD_Index[i]; Signal_Up[i] = 0; }
       }
    return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: