Navigation:Home > Content >

BSI.mq4

Time: 2013-07-20 | Download file:BSI.mq4

//+------------------------------------------------------------------+
//|                                                          BSI.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 Lime
#property indicator_color3 DeepPink
#property indicator_color4 Blue
#property indicator_width4 5
#property indicator_color5 Red
#property indicator_width5 5
#property indicator_level1 50

//---- buffers
double BUY[];
double SELL[];
double GBPUSD[];
double EURUSD[];
double USDCHF[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,GBPUSD);

   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,EURUSD);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,USDCHF);

   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,BUY);

   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,SELL);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i, j, counted_bars=IndicatorCounted();
//----
   i=Bars-counted_bars;
   while(i>=0)
   {
     GBPUSD[i]=iCustom("GBPUSD",0,"RSX",3,0,i);
     EURUSD[i]=iCustom("EURUSD",0,"RSX",3,0,i);
     USDCHF[i]=iCustom("USDCHF",0,"RSX",3,0,i);
     int GU_Trig=1,EU_Trig=1,UC_Trig=1,vTrig;
     if(GBPUSD[i]<50)GU_Trig=-1;
     if(EURUSD[i]<50)EU_Trig=-1;
     if(USDCHF[i]<50)UC_Trig=-1;
     vTrig=GU_Trig+EU_Trig-UC_Trig;
     if(vTrig>2)
     {
       BUY[i]=50;
       SELL[i]=EMPTY_VALUE;
     } else 
     if(vTrig<-2)
     {
       BUY[i]=EMPTY_VALUE;
       SELL[i]=50;
     }
     else 
     {
       BUY[i]=EMPTY_VALUE;
       SELL[i]=EMPTY_VALUE;
     }
     i--;
   }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend