BarsC-O





//+------------------------------------------------------------------+
//|                                                      BarsC-O.mq4 |
//|                                                                  |
//|                                                       Êâàíò      |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2006"
#property link      "Kvant"

#property indicator_chart_window
#property indicator_color1 Red
#property indicator_buffers 2
#property indicator_color2 Blue

//+------------------------------------------------------------------+
//| Common External variables                                        |
//+------------------------------------------------------------------+
extern int body         = 0;
//+------------------------------------------------------------------+
//| Special Convertion Functions                                     |
//+------------------------------------------------------------------+

int LastTradeTime;
double ExtHistoBuffer[];
double ExtHistoBuffer2[];

void SetLoopCount(int loops)
{
}

void SetIndexValue(int shift, double value)
{
  ExtHistoBuffer[shift] = value;
}

void SetIndexValue2(int shift, double value)
{
  ExtHistoBuffer2[shift] = value;
}

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

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

int init()
{
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID);
   SetIndexBuffer(1, ExtHistoBuffer2);
   SetIndexArrow(1,233);
   SetIndexArrow(0,234);
   return(0);
}
int start()
{
//+------------------------------------------------------------------+
//| Local variables                                                  |
//+------------------------------------------------------------------+
int shift = 0;
double sell = 0;
double buy = 0;


SetLoopCount(0);
// loop from first bar to current bar (with shift=0)
for(shift=Bars-1;shift>=0 ;shift--){ 
	SetIndexValue(shift, 0);
	SetIndexValue2(shift, 0);
} 

for(shift=Bars-100;shift>=0 ;shift--){ 


if((Close[shift]<Open[shift]) && (Open[shift]-Close[shift]>body*Point)){
   sell=High[shift]+15*Point;buy=0.00001;}  else sell=0.00001;

if((Close[shift]>Open[shift]) && (Close[shift]-Open[shift]>body*Point)){
   buy=Low[shift]-15*Point;sell=0.00001;}  else buy=0.00001;
 
   SetIndexValue(shift,sell);SetIndexValue2(shift,buy);}   return(0);
}



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains open prices of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: