Disliked{quote} you were on the right track. Now I fixed the necessary. You can think of an array as a place where you have a lot of slots which are indexed with numbers, you can put a number in each slot. more info here (easy understandable source). You can imagine Buffer as memory area containing numeric values of an indicator array. MODIFIED: //+------------------------------------------------------------------+ //| Candle_Range_separate_BullBear.mq4 | //| Rex Tradewell | //| //+------------------------------------------------------------------+...Ignored
OK, thank you, I think I have it. It still only shows the blue line but how does this look?
//+------------------------------------------------------------------+
//| Candle_Range_separate_BullBear.mq4 |
//| Rex Tradewell |
//|
//+------------------------------------------------------------------+
#property copyright "Rex Tradewell"
#property link ""
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 SkyBlue
#property indicator_width1 2
#property indicator_color2 Red
#property indicator_width2 2
double OpenClose_Buffer[],HighLow_Buffer[];
int PipFactor = 1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,OpenClose_Buffer);
SetIndexBuffer(1,HighLow_Buffer);
SetIndexLabel(0,"Range");
SetIndexLabel(1,"Range");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Candle Range BullBear");
SetIndexLabel(0,"Bull");
SetIndexLabel(1,"Bear");
IndicatorDigits(2);
// Cater for fractional pips
if (Digits == 3 || Digits == 5)
{
PipFactor = 1;
}
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//--- Bull counted in the 1-st buffer
for(int i=0; i<limit;i++)
OpenClose_Buffer[i]=MathAbs((Open[i]-Close[i])/Point)/PipFactor;
//--- Bear counted in the 2-nd buffer
HighLow_Buffer[i]=MathAbs((High[i]-Low[i])/Point)/PipFactor;
//---- done
return(0);
}
//+------------------------------------------------------------------+