Welch Bollinger Band ® Width

0
(0)
姓名:
Welch Bollinger Band ® Width
作者: maj1es2tic (2011.08.08 12:44)
已下載: 6131
下載:
Welch Bollinger Band ® Width 1
WelchBBWidth.mq4 (5.0 KB) 看法
作者:

maj1es2tic (Tim Welch)

描述:

This indicator takes the current Width of the Bollinger Bands and compares it to the Maximum and Minimum Width of the Bollinger Bands over N periods (WidthCalcPeriod).

If the calculated percentage is less than or equal to MinRangePercent, then the histogram shows Green. If the calculated percentage is 2x the MinRangePercent, then the histogram shows Yellow. If neither of those match, the histogram shows Red.

This works out well to quickly see if the currency pair is ranging, or about to break out of range. If you set ShowWidthLine to true, then it will also show a line with the actual width of the Bollinger Bands in PIPS. This should work for 4 和 5 digit brokers and it works on all currency pairs.

Using iCustom to pull out values for an Expert Advisor or other Custom Indicators:

You should be able to pull out any of the values externally using the following code:

int period=0; // how far back do you want to look? 0 == current bar. 1 == previous bar, ETC.
              // At any given time, only one of these 3 will have a value greater than 0. That value is 300.

double WelchBBWidth_Green = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 0, 時期);
double WelchBBWidth_Yellow = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 1, 時期);
double WelchBBWidth_Red = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 2, 時期);

// This will give you the actual width in PIPs of the Bollinger Bands
double WelchBBWidth = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 3, 時期);

// These will give you the actual Bollinger Band Line values.
// These are the values that would be plotted on the MAIN chart, so it's based on price on the chart.
double WelchBBWidth_MiddleLine = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 4, 時期);
double WelchBBWidth_UpperLine = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 5, 時期);
double WelchBBWidth_LoweLine = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 6, 時期);

You could put something like this in your Expert Advisor:

/*
* int areWeRanging(int period=0)
*
* Returns 1 for GREEN (ranging)
* Returns -1 for YELLOW ( start/end of range)
* Returns 0 否則 (no range)
*/

int areWeRanging(int period=0) 
{
 double WelchBBWidth_Green = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 0, 時期);
 double WelchBBWidth_Yellow = iCustom(無效的, 0, "WelchBBWidth", 20, 0, 2.0, 20, "X", 100, "X", 錯誤的, 1, 時期);

 如果 ( WelchBBWidth_Green > 0 ) 
 {
   return (1);
 } 
 else if ( WelchBBWidth_Yellow > 0) 
 {
   return (-1);
 }

 return (0);
}

// Check to see if we are coming out of a range. 
// This tells us that the LAST candle was still in a range,
// but the current candle is now breaking free of the range.
如果 ( areWeRanging(1)==1 && (areWeRanging(0)==-1 || areWeRanging(0)==0) ) 
 {
  Print("We were ranging, but have now broken out of the range! Make a trade if other indicators confirm the breakout!");
 }

** Use any/all code at your own discretion, and only place real trades when you have confirmation of other indicators. **

圖像:

Welch Bollinger Band ® Width 2

*筆記: The dark grey vertical lines and red arrows were added to show the correlation of the indicator to the bollinger bands on the chart and they will NOT show up on your chart.

Welch Bollinger Band ® Width 3

Enjoy!

-Tim

這篇文章有多有用?

點擊一顆星即可對其進行評分!

平均評分 0 / 5. 計票數: 0

目前還沒有投票! 成為第一個評價這篇文章的人.

很抱歉這篇文章對您沒有用!

讓我們改進這篇文章!

告訴我們如何改進這篇文章?



作者: 外匯維基團隊
我們是一支經驗豐富的外匯交易員團隊 [2000-2023] 致力於以我們自己的方式生活的人. 我們的主要目標是實現財務獨立和自由, 我們追求自我教育並在外匯市場上獲得豐富的經驗,以此作為實現自我可持續生活方式的手段.