bollinger bands

 
Hi Slawa. i want to delete the middle line in bollinger bands. how i can do that? also remind you the zigzag indicator as soon as possible pls.
 
no problem 2 code lines
//+------------------------------------------------------------------+
//|                                                    Bollinger.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net/

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 RoyalBlue
#property indicator_color2 RoyalBlue
//---- indicator parameters
extern int BB_Period=20;
extern int BB_Deviations=2;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexDrawBegin(0,BB_Period);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexDrawBegin(1,BB_Period);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)
     {
      ExtMapBuffer1[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,i);
      ExtMapBuffer2[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,i);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+


don't worry about zigzag. it will be added as standard(not custom) indicator. but i don't know exactly in what time

 
While you are at it....

Slawa - could you please convert this MT3 Indiator to MT4 for me...? I use it every day.

Thanks

/*[[
Name := iTrend 1.01
Author := Andrew
Link := http://anri.aney.ru/forex/
Notes := TREND INDICATOR
Separate Window := YES
First Color := blue
First Draw Type := histogram
First Symbol := 217
Use Second Data := Yes
Second Color := red
Second Draw Type := histogram
Second Symbol := 218
]]*/
inputs: iBands_Mode_0_2(0); // =0-2 MODE_MAIN, MODE_LOW, MODE_HIGH
inputs: iPower_Price_0_6(0); // =0-6 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW,PRICE_
MEDIAN,PRICE_TYPICAL,PRICE_WEIGHTED
inputs: iPrice_Type_0_3(0); // =0-3 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW
inputs: iBands_Period(20);//20
inputs: iBands_Deviation(2);
inputs: iPower_Period(14);//13
Vars: value(0),value2(0),CurrentBar(0),Bands_Mode(0),Pow
er_Price(0),CurrentPrice(0);



SetLoopCount(0);
if iBands_Mode_0_2=1 then Bands_Mode=MODE_LOW
else if iBands_Mode_0_2=2 then Bands_Mode=MODE_HIGH
else Bands_Mode=MODE_MAIN;



if iPower_Price_0_6=1 then Power_Price=PRICE_OPEN
else if iPower_Price_0_6=2 then Power_Price=PRICE_HIGH
else if iPower_Price_0_6=3 then Power_Price=PRICE_LOW
else if iPower_Price_0_6=4 then Power_Price=PRICE_MEDIAN
else if iPower_Price_0_6=5 then Power_Price=PRICE_TYPICAL
else if iPower_Price_0_6=6 then Power_Price=PRICE_WEIGHTED
else Power_Price=PRICE_CLOSE;



For CurrentBar=Bars+1 DownTo 0 begin
if iPrice_Type_0_3=1 then CurrentPrice=open[CurrentBar]
else if iPrice_Type_0_3=2 then CurrentPrice=high[CurrentBar]
else if iPrice_Type_0_3=3 then CurrentPrice=low[CurrentBar]
else CurrentPrice=close[CurrentBar];
value=CurrentPrice- iBands(iBands_Period,iBands_Deviation,Bands_Mode,C
urrentBar);
if value < 0 then value = 0;
if value > 0 then value = 1;
setIndexValue(CurrentBar, value);
value2=- (iBearsPower(iPower_Period,Power_Price,CurrentBar)
+iBullsPower(iPower_Period,Power_Price,CurrentBar)
);
if value2 < 0 then value2 = 0;
if value2 > 0 then value2 = -1;
setIndexValue2(CurrentBar, value2);
if value = 1 then SetGlobalVariable("MEDV",value);
if value2 = -1 then SetGlobalVariable("MEDV",value);
if value2 = -1 and value = 1 then SetGlobalVariable("MEDV",0);
//SetGlobalVariable("BUK",value);
end;
 

Dear All,

I would like to find out how to alter the iTrend.mq4 so that I could have the 4 hour itrend on the 1 hour chart. In ohter words the i trend for one chart up on the lower chart.

Thanks,

Tom

 
Slawa :
no problem 2 code lines
//+------------------------------------------------------------------+
//| Bollinger.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 RoyalBlue
#property indicator_color2 RoyalBlue
//---- indicator parameters
extern int BB_Period=20;
extern int BB_Deviations=2;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexDrawBegin(0,BB_Period);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexDrawBegin(1,BB_Period);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
ExtMapBuffer1[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,i);
ExtMapBuffer2[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+


don't worry about zigzag. it will be added as standard(not custom) indicator. but i don't know exactly in what time

Slawa :
no problem 2 code lines
//+------------------------------------------------------------------+
//|                                                    Bollinger.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 RoyalBlue
#property indicator_color2 RoyalBlue
//---- indicator parameters
extern int BB_Period=20;
extern int BB_Deviations=2;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexDrawBegin(0,BB_Period);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexDrawBegin(1,BB_Period);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)
     {
      ExtMapBuffer1[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,i);
      ExtMapBuffer2[i]=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,i);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+


don't worry about zigzag. it will be added as standard(not custom) indicator. but i don't know exactly in what time

 

Hi Slawa,


I also want to delete the middle line in bollinger bands but i'm a bit of a technophobe so what do I do with the "code" please?


Also I want to add the following Bollinger Band to my chart (10/1.9). Would this be done by inputing 10 in the "Period" box and 1.9 in the "Deviations" box?


Looking forward to your response and thanks in advance.


Wink




Reason: