Воскресенье, 28.04.2024, 21:42
Любой кризис начинается с долгов
Главная страница Регистрация Вход
Приветствую Вас, Гость · RSS
на правах рекламы
Меню сайта
Категории раздела
Мои файлы [4]
Forex4you


Наш опрос
Как Вы оцениваете перспективы американского доллара?
Всего ответов: 48
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Форма входа
Поиск
 Каталог файлов
Главная » Файлы » Мои файлы

Индикатор "MMA color"
[ Скачать с сервера (3.0 Kb) ] 20.10.2010, 22:46
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Black
#property  indicator_color2  Blue
#property  indicator_color3  Red

//---- indicator buffers
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];

extern int PeriodMA=120;
extern int TypeMA=1;
extern string Mode1_ = "0 - MODE_SMA  Простое скользящее среднее ";
extern string Mode2_ = "1 - MODE_EMA  Экспоненциальное скользящее среднее ";
extern string Mode3_ = "2 - MODE_SMMA Сглаженное скользящее среднее ";
extern string Mode4_ = "3 - MODE_LWMA  Линейно-взвешенное скользящее среднее ";

extern int PriceMA=4;
extern string Price1_ = "0 - PRICE_CLOSE    Цена закрытия";
extern string Price2_ = "1 - PRICE_OPEN     Цена открытия";
extern string Price3_ = "2 - PRICE_HIGH     Цена максимума";
extern string Price4_ = "3 - PRICE_LOW      Цена минимума" ;
extern string Price5_ = "4 - PRICE_MEDIAN   Цена середины" ;
extern string Price6_ = "5 - PRICE_TYPICAL  Цена типическая";
extern string Price7_ = "6 - PRICE_WEIGHTED Цена взвешенная" ;
extern int Shift=6;

extern double Sensit=0.0001;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
   SetIndexDrawBegin(2,34);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MMA color("+PeriodMA+", "+Shift+", "+TypeMA+", "+PriceMA+", "+Sensit+")");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- initialization done
   return(0);
  }
 
 
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd
   for(int i=0; i<limit; i++)
      ExtBuffer0[i]=iMA(NULL,0,PeriodMA,1,TypeMA,PriceMA,i)-iMA(NULL,0,PeriodMA,1,TypeMA,PriceMA,i+Shift);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev+Sensit) up=true;
      if(current<prev-Sensit) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
//---- done
   return(0);
  }
Категория: Мои файлы | Добавил: fxpart
Просмотров: 845 | Загрузок: 81 | Комментарии: 1 | Рейтинг: 0.0/0
Всего комментариев: 0
Имя *:
Email *:
Код *:
Copyright MyCorp © 2024
заработок без вложений

Дилинговый центр FX Start
Бесплатный хостинг uCoz