ExchangePrice

Author: Copyright 2013, papaklass
Miscellaneous
Implements a curve of type %1
1 Views
0 Downloads
0 Favorites
ExchangePrice
//+----------------------------------------------------------------------------+
//|                                                          ExchangePrice.mq4 |
//|                                                  Copyright 2013, papaklass |
//|                                     http://www.mql4.com/ru/users/papaklass |
//+----------------------------------------------------------------------------+
#property copyright "Copyright 2013, papaklass"
#property link      "http://www.mql4.com/ru/users/papaklass"

//+----------------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Yellow
//+----------------------------------------------------------------------------+
extern int    countBarsS = 96;
extern int    countBarsL = 288;
//+----------------------------------------------------------------------------+

//--- buffers
double buffShort[];
double buffLong[];
//+----------------------------------------------------------------------------+

int init(){
//---- indicators
   SetIndexStyle(  0, DRAW_LINE  );
   SetIndexBuffer( 0, buffShort );
   SetIndexLabel(  0, "short");

   SetIndexStyle(  1, DRAW_LINE  );
   SetIndexBuffer( 1, buffLong );
   SetIndexLabel(  1, "long");
   
   SetLevelValue( 1, 0.0 );
   //----
   return(0);
}//+--------------------------------------------------------------------------+

int deinit(){

   return(0);
}//+--------------------------------------------------------------------------+

int start(){
   int    counted_bars=IndicatorCounted();

   if( counted_bars > 0 ){ counted_bars--; }
   int limit = Bars - counted_bars;

   for( int i = 0; i < limit; i++){

   double current = Close[i];
   
   double historyS = Close[i + countBarsS];
   double historyL = Close[i + countBarsL];
   
      buffShort[i] = ( current - historyS ) / Point;
      buffLong[i] = ( current - historyL ) / Point;
   }

   return(0);
}//+--------------------------------------------------------------------------+

Comments