Группа "Стол заказов MQL"

Рейтинг 2087



РЕКОМЕНДУЮ



Можно ли сделать такое?

информация взята от сюда: ru.tradingview.com/script/RXZNrGmE-Bollinger-Bands-B-Bollinger-Bands-Version-2/

код скрипта на ТВ:

//Updated by ChrisMoody on 8/14/2014 --  Original Code From ucsgears
study(title = "Bollinger Bands %B Bollinger Bands", shorttitle = "BB %B BB")
source = close
length = input(20, minval=1), mult = input(2.0, minval=0.001, maxval=50)
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
bbr = (source - lower)/(upper - lower)
//plot(bbr, color=teal)
 
basisa = sma(bbr, length)
deva = mult * stdev(bbr, length)
uppera = basisa + deva
lowera = basisa - deva
 
//Added This
aboveUp = bbr > uppera ? 1 : 0
belowDn = bbr < lowera ? 1 : 0
plotchar(aboveUp, title="i", char='S', location=location.top, color=red, transp=0, offset=0)
plotchar(belowDn, title="i", char='B', location=location.bottom, color=green, transp=0, offset=0)
 
//Added in BackGround Hilighting
noTrade = aboveUp == 0 and belowDn == 0
bgcolor(noTrade ? gray : na, transp=50)
bgcolor(aboveUp ? red : na, transp=60)
bgcolor(belowDn ? green : na, transp=60)
 
//Added This
col = bbr < lowera ? lime : bbr > uppera ? red : teal
 
//Changed your plot fills from Midline to top of band...and midline to lower band.
p1 = plot(basisa, color=silver, linewidth=0)
p2 = plot(uppera, color=red, linewidth=2)
p3 = plot(lowera, color=green, linewidth=2)
fill(p1, p2, color=red, transp = 70)
fill(p1, p3, color=green, transp = 70)
plot(bbr, color= col, style=linebr, linewidth=3)




было бы очень приятного видеть такой индикатор в мт4
  • 0
  • Просмотров: 2168
  • 19 сентября 2017, 22:39
  • maksGruv
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

Вступите в группу "Стол заказов MQL", чтобы следить за обновлениями
ПРИСОЕДИНИТЬСЯ К ГРУППЕ
присоединиться
  Предыдущая запись в группе
Пинг-понг с удвоением.
Следующая запись в группе  
Советник круглых уровней
15 сентября 2017
20 сентября 2017

Комментарии (8)

+
0
код скрипта на ТВ:

А если по русски? :D 
avatar

  34  AM2 Сообщений: 15880 - Андрей

  • 20 сентября 2017, 00:34
+
0
Андрей привет, код взят с трейдинг вьев.ком
Интересная темка бб в подвале с %бб, в одном индюке)
avatar

  9  maksGruv Автор Сообщений: 340

  • 20 сентября 2017, 12:56
+
0
Андрей привет, код взят с трейдинг вьев.ком

ТЗ на индикатор рассмотрю.
avatar

  34  AM2 Сообщений: 15880 - Андрей

  • 20 сентября 2017, 13:34
+
0
Андрей ну как смотрел?
avatar

  9  maksGruv Автор Сообщений: 340

  • 22 сентября 2017, 14:58
+
0
Смотрел что? ТЗ то нет.
avatar

  34  AM2 Сообщений: 15880 - Андрей

  • 22 сентября 2017, 16:34
+
0
Я сделал набросок для индикатора. если вам известны формулы для расчета линий индикатора, то возможно доделать:




//+------------------------------------------------------------------+
//|                                                    BBProcent.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_separate_window

#property indicator_buffers 3

#property indicator_color1 Green
#property indicator_color2 Green
#property indicator_color3 Red

input int    MAPeriod=8;       // MA Period
input int    BBPeriod=20;      // Bands Period
input int    BBShift=0;        // Bands Shift
input double BBDeviations=2.0; // Bands Deviations

double up[];
double dn[];
double ma[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,up);
//--- upper band
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,dn);
//--- lower band
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ma);
//---
   return(INIT_SUCCEEDED);
  }
  //+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double GetAppliedPrice(int nAppliedPrice, int nIndex)
  {
   double dPrice;
//----
   switch(nAppliedPrice)
     {
      case 0:  dPrice=Close[nIndex];                                  break;
      case 1:  dPrice=Open[nIndex];                                   break;
      case 2:  dPrice=High[nIndex];                                   break;
      case 3:  dPrice=Low[nIndex];                                    break;
      case 4:  dPrice=(High[nIndex]+Low[nIndex])/2.0;                 break;
      case 5:  dPrice=(High[nIndex]+Low[nIndex]+Close[nIndex])/3.0;   break;
      case 6:  dPrice=(High[nIndex]+Low[nIndex]+2*Close[nIndex])/4.0; break;
      default: dPrice=0.0;
     }
//----
   return(dPrice);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   for(int i=0;i<1000;i++)
     {
      double bup=iBands(NULL,0,BBPeriod,BBDeviations,BBShift,0,1,i);
      double bdn=iBands(NULL,0,BBPeriod,BBDeviations,BBShift,0,2,i);
      ma[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
      up[i]=bup;
      dn[i]=bdn;
      //ma[i]=(Close[i]-bdn)/(bup-bdn);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


Редактирован: 22 сентября 2017, 21:30
avatar

  34  AM2 Сообщений: 15880 - Андрей

  • 22 сентября 2017, 18:24
+
0
Спасибо) попробую)
avatar

  9  maksGruv Автор Сообщений: 340

  • 24 сентября 2017, 18:52
+
+1
:D  Чего там пробовать??? Там же написано

если вам известны формулы для расчета линий индикатора, то возможно доделать:


А значит нужны расчеты.
avatar

  14  Syte Сообщений: 399

  • 16 октября 2017, 16:27

Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий
Начать торговлю с Альпари