DonOmar
Arab sheikh

 
Уровень 5

  Торгую в компаниях:


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

Рейтинг 2081



РЕКОМЕНДУЮ



Заказ: Объединить индикаторы.

Здравствуйте уважаемы программисты! Если Вам не сложно, то пожалуйста, выполните заказ.

Нужно объединить два индикатора в один это CCI и RSI, что бы получился типа Stochastic, но чтобы уровни и диапазоны оставались у каждого свои. Возможно такое сделать?

платформа mt4.
  • 0
  • Просмотров: 2244
  • 25 мая 2016, 13:29
  • DonOmar
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

Вступите в группу "Стол заказов MQL", чтобы следить за обновлениями
ПРИСОЕДИНИТЬСЯ К ГРУППЕ
присоединиться
  Предыдущая запись в группе
переделать под пятизнак
Следующая запись в группе  
FX5_MACD_Divergence_V1.0.
24 мая 2016
26 мая 2016

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

+
0
Может вы сразу попросите сделать советник по этим индикаторам :) 

Вот Т3, реально прибыльной системы. Только там второй индикатор АТR, он похож на ССI :)  Там входы и выходы разные, надо сделать отдельные настройки для входов и отдельные для выходов.

Ну или если будет время у Андрея и сделает без заказа :) 

Логика
Открытие (Сигнал входа)
Open a new long position at the beginning of the bar when all the following logic conditions are satisfied:

RSI* (Smoothed, Close, 10) crosses the Level 31 upward; and
Average True Range* (Simple, 14) rises.
Open a new short position at the beginning of the bar when all the following logic conditions are satisfied:

RSI* (Smoothed, Close, 10) crosses the Level 69 downward; and
Average True Range* (Simple, 14) rises.
Закрытие (Сигнал выхода)
Close an existing long position at the end of the bar when the following logic condition is satisfied:

RSI (Smoothed, Close, 15) crosses the Level 70 downward.
Close an existing short position at the end of the bar when the following logic condition is satisfied:

RSI (Smoothed, Close, 15) crosses the Level 30 upward.
Обработка добавочных сигналов входа**
Entry signal in the direction of the present position:

Открыть новую длинную позицию в начале бара, когда удовлетворяются все следующие логические условия:

RSI * ( сглаженная, Close, 10 ) пересекает уровень 31 вверх; а также
Average True Range * ( Простой, 14 ) поднимается.

Открыть новую короткую позицию в начале бара, когда удовлетворяются все следующие логические условия:

RSI * ( сглаженная, Close, 10 ) пересекает уровень 69 вниз; а также
Average True Range * ( Простой, 14 ) поднимается.

Закрытие ( Сигнал выхода )

Закройте существующую длинную позицию, когда следующая логика условие:

RSI ( сглаженная, Close, 15 ) пересекает уровень 70 вниз.

Закройте существующую короткую позицию в конце строки, когда следующая логика условие:

RSI ( сглаженная, Close, 15 ) пересекает уровень 30 вверх.

avatar

  14  beton2011 Сообщений: 895

  • 25 мая 2016, 14:23
+
0
Я в индикаторах не силен, но посмотрю что можно сделать.
avatar

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

  • 25 мая 2016, 14:29
+
0
Можно просто бросить один на другой. Нужно что то вроде этого?

avatar

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

  • 25 мая 2016, 14:38
+
0
да
avatar

  5  DonOmar Автор Сообщений: 84 - Arab sheikh

  • 25 мая 2016, 17:22
+
0
Вот сейчас что то похожее нарисовалось:
www.opentraders.ru/downloads/1187/




//+------------------------------------------------------------------+
//|                                                      RSI_CCI.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#property description "Relative Strength Index"
#property strict

#include <MovingAverages.mqh>

#property indicator_separate_window

#property indicator_buffers    6
#property indicator_color1     DodgerBlue
#property indicator_color2     LightSeaGreen
#property indicator_level1     20.0
#property indicator_level2     80.0
#property indicator_level3    -100.0
#property indicator_level4     100.0
#property indicator_levelcolor clrSilver
#property indicator_levelstyle STYLE_DOT
//--- input parameters
input int InpRSIPeriod=14; // RSI Period
//--- buffers
double ExtRSIBuffer[];
double ExtPosBuffer[];
double ExtNegBuffer[];
//--- input parameter
input int InpCCIPeriod=14; // CCI Period
//--- buffers
double ExtCCIBuffer[];
double ExtPriceBuffer[];
double ExtMovBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   string short_name;
//--- 2 additional buffers are used for counting.
   IndicatorBuffers(6);
   SetIndexBuffer(0,ExtRSIBuffer);
   SetIndexBuffer(1,ExtPosBuffer);
   SetIndexBuffer(2,ExtNegBuffer);
//--- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtRSIBuffer);
//--- name for DataWindow and indicator subwindow label
   short_name="RSI_CCI";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//--- check for input
   if(InpRSIPeriod<2)
     {
      Print("Incorrect value for input variable InpRSIPeriod = ",InpRSIPeriod);
      return(INIT_FAILED);
     }
//---
   SetIndexDrawBegin(0,InpRSIPeriod);
/////////////////
   SetIndexBuffer(4,ExtPriceBuffer);
   SetIndexBuffer(5,ExtMovBuffer);
//--- indicator line
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtCCIBuffer);
//--- check for input parameter
   if(InpCCIPeriod<=1)
     {
      Print("Wrong input parameter CCI Period=",InpCCIPeriod);
      return(INIT_FAILED);
     }
//---
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
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[])
  {
   int    i,k,pos;
   double diff;
   double dSum,dMul;
//---
   if(Bars<=InpRSIPeriod || InpRSIPeriod<2)
      return(0);
//--- counting from 0 to rates_total
   ArraySetAsSeries(ExtRSIBuffer,false);
   ArraySetAsSeries(ExtPosBuffer,false);
   ArraySetAsSeries(ExtNegBuffer,false);
   ArraySetAsSeries(close,false);
//--- preliminary calculations
   pos=prev_calculated-1;
   if(pos<=InpRSIPeriod)
     {
      //--- first RSIPeriod values of the indicator are not calculated
      ExtRSIBuffer[0]=0.0;
      ExtPosBuffer[0]=0.0;
      ExtNegBuffer[0]=0.0;
      double sump=0.0;
      double sumn=0.0;
      for(i=1; i<=InpRSIPeriod; i++)
        {
         ExtRSIBuffer[i]=0.0;
         ExtPosBuffer[i]=0.0;
         ExtNegBuffer[i]=0.0;
         diff=close[i]-close[i-1];
         if(diff>0)
            sump+=diff;
         else
            sumn-=diff;
        }
      //--- calculate first visible value
      ExtPosBuffer[InpRSIPeriod]=sump/InpRSIPeriod;
      ExtNegBuffer[InpRSIPeriod]=sumn/InpRSIPeriod;
      if(ExtNegBuffer[InpRSIPeriod]!=0.0)
         ExtRSIBuffer[InpRSIPeriod]=100.0-(100.0/(1.0+ExtPosBuffer[InpRSIPeriod]/ExtNegBuffer[InpRSIPeriod]));
      else
        {
         if(ExtPosBuffer[InpRSIPeriod]!=0.0)
            ExtRSIBuffer[InpRSIPeriod]=100.0;
         else
            ExtRSIBuffer[InpRSIPeriod]=50.0;
        }
      //--- prepare the position value for main calculation
      pos=InpRSIPeriod+1;
     }
//--- the main loop of calculations
   for(i=pos; i<rates_total && !IsStopped(); i++)
     {
      diff=close[i]-close[i-1];
      ExtPosBuffer[i]=(ExtPosBuffer[i-1]*(InpRSIPeriod-1)+(diff>0.0?diff:0.0))/InpRSIPeriod;
      ExtNegBuffer[i]=(ExtNegBuffer[i-1]*(InpRSIPeriod-1)+(diff<0.0?-diff:0.0))/InpRSIPeriod;
      if(ExtNegBuffer[i]!=0.0)
         ExtRSIBuffer[i]=100.0-100.0/(1+ExtPosBuffer[i]/ExtNegBuffer[i]);
      else
        {
         if(ExtPosBuffer[i]!=0.0)
            ExtRSIBuffer[i]=100.0;
         else
            ExtRSIBuffer[i]=50.0;
        }
     }
//---
//---
   if(rates_total<=InpCCIPeriod || InpCCIPeriod<=1)
      return(0);
//--- counting from 0 to rates_total
   ArraySetAsSeries(ExtCCIBuffer,false);
   ArraySetAsSeries(ExtPriceBuffer,false);
   ArraySetAsSeries(ExtMovBuffer,false);
   ArraySetAsSeries(high,false);
   ArraySetAsSeries(low,false);
   ArraySetAsSeries(close,false);
//--- initial zero
   if(prev_calculated<1)
     {
      for(i=0; i<InpCCIPeriod; i++)
        {
         ExtCCIBuffer[i]=0.0;
         ExtPriceBuffer[i]=(high[i]+low[i]+close[i])/3;
         ExtMovBuffer[i]=0.0;
        }
     }
//--- calculate position
   pos=prev_calculated-1;
   if(pos<InpCCIPeriod)
      pos=InpCCIPeriod;
//--- typical price and its moving average
   for(i=pos; i<rates_total; i++)
     {
      ExtPriceBuffer[i]=(high[i]+low[i]+close[i])/3;
      ExtMovBuffer[i]=SimpleMA(i,InpCCIPeriod,ExtPriceBuffer);
     }
//--- standard deviations and cci counting
   dMul=0.015/InpCCIPeriod;
   pos=InpCCIPeriod-1;
   if(pos<prev_calculated-1)
      pos=prev_calculated-2;
   i=pos;
   while(i<rates_total)
     {
      dSum=0.0;
      k=i+1-InpCCIPeriod;
      while(k<=i)
        {
         dSum+=MathAbs(ExtPriceBuffer[k]-ExtMovBuffer[i]);
         k++;
        }
      dSum*=dMul;
      if(dSum==0.0)
         ExtCCIBuffer[i]=0.0;
      else
         ExtCCIBuffer[i]=(ExtPriceBuffer[i]-ExtMovBuffer[i])/dSum;
      i++;
     }
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+


Редактирован: 26 мая 2016, 07:27
avatar

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

  • 25 мая 2016, 20:29
+
0
хорошо.
avatar

  5  DonOmar Автор Сообщений: 84 - Arab sheikh

  • 25 мая 2016, 20:47
+
0
да, именно так и надо было сделать. Спасибо огромное!:) 
avatar

  5  DonOmar Автор Сообщений: 84 - Arab sheikh

  • 26 мая 2016, 03:50
+
0
Добавь на график один индикатор, а второй на него перетащи из списка, мышкой.
avatar

  23  vomisin Сообщений: 110

  • 26 мая 2016, 06:21

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