0
Вот :D 




//+------------------------------------------------------------------+
//|                                                   BullBearMA.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link      "http://www.forexsyatems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window

#property indicator_buffers    4
#property indicator_color1     Green
#property indicator_color2     Red
#property indicator_color3     Blue

input int MAPeriod=14;
input int Count=1000;
//--- buffers
double bull[];
double bear[];
double bu[1];
double be[1];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- 
   SetIndexBuffer(0,bull);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,bear);
   SetIndexStyle(1,DRAW_LINE);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   ArraySetAsSeries(bull,true);
   ArraySetAsSeries(bear,true);

   string s="";

   for(int i=0;i<Count;i++)
     {
      if(close[i]>open[i])
        {
         bu[ArraySize(bu)-1]=close[i];
         ArrayResize(bu,ArraySize(bu)+1);
        }

      if(close[i]<open[i]) 
        {
         be[ArraySize(be)-1]=close[i];
         ArrayResize(be,ArraySize(be)+1);
        }
     }

   for(int i=0;i<ArraySize(bu);i++) StringAdd(s,"\n "+(string)bu[i]);
   
   for(int i=0;i<ArraySize(bu);i++) bull[i]=iMAOnArray(bu,0,MAPeriod,0,0,i);
   for(int i=0;i<ArraySize(be);i++) bear[i]=iMAOnArray(be,0,MAPeriod,0,0,i);
   
   Comment("\n ARR: ",s);
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 7 февраля 2018, 18:42
0
Сегодня есть свободное время, посмотрю еще.
avatar

AM2

  • 7 февраля 2018, 17:45
0
Я пробовал сделать, не получилось быстро.


//+------------------------------------------------------------------+
//|                                                   BullBearMA.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link      "http://www.forexsyatems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window

#property indicator_buffers    3
#property indicator_color1     Green
#property indicator_color2     Red
#property indicator_color3     Blue

input int MAPeriod=14;
//--- buffers
double bull[];
double bear[];
double ma[];
double bu[];
double be[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- 
   SetIndexBuffer(0,bull);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,bear);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(2,ma);
   SetIndexStyle(2,DRAW_LINE);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   ArraySetAsSeries(bull,true);
   ArraySetAsSeries(bear,true);
   string s="";

   for(int i=0;i<10;i++)
     {
      if(close[i]>open[i]) bu[i]=close[i];
      if(close[i]<open[i]) be[i]=close[i];
      bull[i]=iMAOnArray(bu,0,MAPeriod,0,0,i);
      bear[i]=iMAOnArray(be,0,MAPeriod,0,0,i);
      ma[i]=iMA(NULL,0,MAPeriod,0,0,0,i);
      s=StringConcatenate(s,(string)bu[i]);
     }

   Comment("\n ARR: ",s);
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 6 февраля 2018, 19:37
0
в настройках меняйте коды значков
avatar

AM2

  • 6 февраля 2018, 19:10
0
По индикатору RSI с периодом 14
avatar

AM2

  • 6 февраля 2018, 17:30
0
По лишним ордерам то что смог поправил: www.opentraders.ru/downloads/1781/



Далее к платному.
avatar

AM2

  • 5 февраля 2018, 20:30
0
Покажите на скринах как все это должно выглядеть и по какой формуле рассчитывать линии индикатора?
avatar

AM2

  • 5 февраля 2018, 20:15
0
Покажите на скринах входы?
avatar

AM2

  • 5 февраля 2018, 20:12
0
Вернул прежние настройки. Если вас смущают лишние входные переменные, просто не обращайте на них внимание. Манименеджмент писался под другой советник, его нужно целиком переписывать под ваше ТЗ. В обновленной версии ММ немного подправил.

www.opentraders.ru/downloads/1799/
avatar

AM2

  • 5 февраля 2018, 20:09
0
Сложный не берусь.
avatar

AM2

  • 5 февраля 2018, 19:41
0
не начал
avatar

AM2

  • 5 февраля 2018, 00:17
0
Во вторник посмотрю.
avatar

AM2

  • 4 февраля 2018, 15:49
0
Посмотрю завтра.
avatar

AM2

  • 4 февраля 2018, 15:42
0
С задеванием к платному.
avatar

AM2

  • 4 февраля 2018, 15:37
0
Так сделаете проверку какой кнопкой мыши кликнули на графике и определите координаты:




//+------------------------------------------------------------------+
//|                                                        Baton.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link      "http://www.forexsyatems.biz"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
//--- включение сообщений о перемещении мыши по окну чарта
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,1);
   PutButton("B",55,55,"БАТОН");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutButton(string name,int x,int y,string text)
  {
   ObjectCreate(0,name,OBJ_BUTTON,0,0,0);
//--- установим координаты кнопки
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
//--- установим размер кнопки
   ObjectSetInteger(0,name,OBJPROP_XSIZE,80);
   ObjectSetInteger(0,name,OBJPROP_YSIZE,30);
//--- установим угол графика, относительно которого будут определяться координаты точки
   ObjectSetInteger(0,name,OBJPROP_CORNER,2);
//--- установим текст
   ObjectSetString(0,name,OBJPROP_TEXT,text);
//--- установим шрифт текста
   ObjectSetString(0,name,OBJPROP_FONT,"Arial");
//--- установим размер шрифта
   ObjectSetInteger(0,name,OBJPROP_FONTSIZE,12);
//--- установим цвет текста
   ObjectSetInteger(0,name,OBJPROP_COLOR,Red);
//--- установим цвет фона
   ObjectSetInteger(0,name,OBJPROP_BGCOLOR,White);
//--- установим цвет границы
   ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,Blue);
//--- включим (true) или отключим (false) режим перемещения кнопки мышью
   ObjectSetInteger(0,name,OBJPROP_SELECTABLE,1);
   ObjectSetInteger(0,name,OBJPROP_SELECTED,1);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
//--- нажатие мышкой на графике
   if(id==CHARTEVENT_MOUSE_MOVE)
     {
      if(sparam=="1") Comment("Нажатие левой кнопки мышки на графике!"+"\n  Координаты  мышки на графике: x = ",lparam,"  y = ",dparam);
      if(sparam=="2") Comment("Нажатие правой кнопки мышки на графике!"+"\n  Координаты  мышки на графике: x = ",lparam,"  y = ",dparam);
     }
  }
//+------------------------------------------------------------------+



А перехват событий мыши, это уже WinAPI.
avatar

AM2

  • 4 февраля 2018, 11:36
0
Немного доработал советник, поставил нужные функции. Если ваша система не имеет более двух лосей подряд, можно увеличивать лот: www.opentraders.ru/downloads/1799/

avatar

AM2

  • 4 февраля 2018, 09:23
0
Готово:




//+------------------------------------------------------------------+
//|                                                       ATRSig.mq4 |
//|                                              Copyright 2018, AM2 |
//|                                      http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, AM2"
#property link      "http://www.forexsyatems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window

#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

input int period=14;
input int count=1000;
input int upcode=233;
input int dncode=234;
input double lev1=0.007;
input double lev2=0.01;

double up[],dn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,up);
   SetIndexArrow(0,upcode);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1,dn);
   SetIndexArrow(1,dncode);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 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<count;i++)
     {
      double atr1=iATR(NULL,0,period,i);
      double atr2=iATR(NULL,0,period,i+1);
      
      if((atr1<lev1 && atr2>lev1)||(atr1<lev2 && atr2>lev2)) up[i]=high[i];
      if((atr1>lev1 && atr2<lev1)||(atr1>lev2 && atr2<lev2)) dn[i]=high[i];
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 3 февраля 2018, 16:29
0
На четверг.
avatar

AM2

  • 3 февраля 2018, 15:38