- Июнь 10, 2013
- Опубликовано: Команда Форекс Вики
- Категория: Форекс Инд
Имя: |
|
||
Автор: | maj1es2tic (2011.08.08 12:44) | ||
Скачано: | 6131 | ||
Скачать: |
|
||
Автор:
maj1es2tic (Тим Уэлч) Описание:Этот индикатор принимает текущую ширину полос Боллинджера и сравнивает ее с максимальной и минимальной шириной полос Боллинджера за N периодов. (ШиринаCalcPeriod). 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, и т. д.. // 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, "Икс", 100, "Икс", ЛОЖЬ, 0, период); double WelchBBWidth_Yellow = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 1, период); double WelchBBWidth_Red = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 2, период); // This will give you the actual width in PIPs of the Bollinger Bands double WelchBBWidth = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 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, "Икс", 100, "Икс", ЛОЖЬ, 4, период); double WelchBBWidth_UpperLine = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 5, период); double WelchBBWidth_LoweLine = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 6, период); You could put something like this in your Expert Advisor: /* * int areWeRanging(int period=0) * * Возвращает 1 for GREEN (ranging) * Возвращает -1 for YELLOW ( start/end of range) * Возвращает 0 в противном случае (no range) */ int areWeRanging(int period=0) { double WelchBBWidth_Green = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 0, период); double WelchBBWidth_Yellow = iCustom(НУЛЕВОЙ, 0, "WelchBBWidth", 20, 0, 2.0, 20, "Икс", 100, "Икс", ЛОЖЬ, 1, период); если ( WelchBBWidth_Green > 0 ) { возвращаться (1); } else if ( WelchBBWidth_Yellow > 0) { возвращаться (-1); } возвращаться (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) ) { Распечатать("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. ** Изображение:
*ПРИМЕЧАНИЕ: 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. Наслаждаться! -Tim |