#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQ4 Indicators
Title: Bollinger Bands %b
Description:
Bollinger Bands %b, the forumla used is BLG B% = (Close – Band Low) / (Band high – Band Low)
//+-------------------------------------------------------------------+ //| Bollinger Bands %b.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //| Modified by Alejandro Galindo | //| | //| You are free to use it | //| | //| If you want and if this work/modification is helpful to you | //| you can send me a PayPal donation to ag@elcactus.com | //+-------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Yellow //---- input parameters extern int BBPeriod=20; extern int StdDeviation=2; //---- buffers double BLGBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,BLGBuffer); //---- name for DataWindow and indicator subwindow label short_name="BBpB("+BBPeriod+","+StdDeviation+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,BBPeriod); //---- return(0); } //+------------------------------------------------------------------+ //| Momentum | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- if(Bars<=BBPeriod) return(0); //---- initial zero if(counted_bars<1) for(i=1;i<=BBPeriod;i++) BLGBuffer[Bars-i]=0.0; //---- i=Bars-BBPeriod-1; if(counted_bars>=BBPeriod) i=Bars-counted_bars-1; while(i>=0) { BLGBuffer[i]=(Close[i]-iBands(NULL,0,BBPeriod,StdDeviation,0,0,MODE_HIGH,i))/(iBands(NULL,0,BBPeriod,StdDeviation,0,0,MODE_LOW,i)-iBands(NULL,0,BBPeriod,StdDeviation,0,0,MODE_HIGH,i)); i--; } return(0); } //+------------------------------------------------------------------+
Author/Source:
Alejandro Galindo
Forex Directory
|
Free Forex Strategies
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact