0
В следующем месяце напомните. У вас в этом есть один заказ.
avatar

AM2

  • 23 сентября 2017, 06:49
0
Завтра набросаю вариант.
avatar

AM2

  • 22 сентября 2017, 18:47
0
Поконкретнее пожалуйста. Чем подробнее все опишите тем ближе к желаемому будет результат.
avatar

AM2

  • 22 сентября 2017, 18:26
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);
  }
//+------------------------------------------------------------------+

avatar

AM2

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

AM2

  • 22 сентября 2017, 16:34
0
Можно, только опишите все подробнее.
avatar

AM2

  • 22 сентября 2017, 16:33
0
Андрей, а проверку доливки (усреднения) от фильтра (машки) нельзя сделать?


Там есть, вот код:


   double ma=iMA(NULL,0,MAPeriod,0,0,0,0);

   bool b=(CountTrades(0)<1 && (Star()==1 || Pogl()==1) && (BuySell==0 || BuySell==2));
   bool s=(CountTrades(1)<1 && (Star()==2 || Pogl()==2) && (BuySell==1 || BuySell==2));

   bool b2=FindOrderType()==0 && FindLastBuyPrice()-Ask>=Step*Point;
   bool s2=FindOrderType()==1 && Bid-FindLastSellPrice()>=Step*Point;

   if(MA)
     {
      b=(CountTrades(0)<1 && Bid>ma && (Star()==1 || Pogl()==1) && (BuySell==0 || BuySell==2));
      s=(CountTrades(1)<1 && Bid<ma && (Star()==2 || Pogl()==2) && (BuySell==1 || BuySell==2));
      b2=FindOrderType()==0  && Bid>ma && FindLastBuyPrice()-Ask>=Step*Point;
      s2=FindOrderType()==1  && Bid>ma && Bid-FindLastSellPrice()>=Step*Point;
     }
avatar

AM2

  • 21 сентября 2017, 22:24
0
Это уже в следующем топике через месяц.
avatar

AM2

  • 21 сентября 2017, 16:34
0
Удалось все сделать даже без разделения магиков: www.opentraders.ru/downloads/1662/

avatar

AM2

  • 21 сентября 2017, 12:53
0
Очень маловероятно что кто то возьмется.
avatar

AM2

  • 20 сентября 2017, 21:43
0
1) Поместить индикатор на график.

Это не обязательно, можно вызвать в икастом.

2) Поместить советник на график, который будет искать горизонтальные линии по уникальному имени. И по их значениям работать.

цену уровня возьмем из имени линии или цены объекта.

а как найдем линию с максимальным объемом?
avatar

AM2

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

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

AM2

  • 20 сентября 2017, 13:34
0
Cоветник сам рассчитывает уровень, сам рисует и торгует: www.opentraders.ru/downloads/1661/

avatar

AM2

  • 20 сентября 2017, 13:32
0
код скрипта на ТВ:

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

AM2

  • 20 сентября 2017, 00:34
0
Опишите упрощенное ТЗ целиком. То что было там, дожи звезда и не нужно вам наверное?
avatar

AM2

  • 19 сентября 2017, 13:46
0
Вроде бы нормально все:




//+------------------------------------------------------------------+
//|                                                         Real.mq4 |
//|                                              Copyright 2017, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots         = 0.1;      // лот
extern double Risk         = 5;        // риск
extern double StopLoss     = 500;      // лось
extern double TakeProfit   = 500;      // язь
extern int Step            = 200;      // шаг
extern int Orders          = 5;        // макс ордеров в рынке
extern int Shift           = 1;        // на каком баре сигнал индикатора
extern int Slip            = 30;       // реквот
extern int CloseSig        = 0;        // 1-закрытие по сигналу
extern int Magic           = 123;      // магик
extern bool Buy            = true;     // buy
extern bool Sell           = true;     // sell

extern string IndName="Real Trend";
extern int SignalPeriod= 15;
extern int ArrowPeriod = 2;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
      if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
     }

   r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//| Check for close order conditions                                 |
//+------------------------------------------------------------------+
void ClosePos()
  {
   double buy=iCustom(NULL,0,IndName,SignalPeriod,ArrowPeriod,2,Shift);
   double sell=iCustom(NULL,0,IndName,SignalPeriod,ArrowPeriod,3,Shift);

   if(sell>0)
     {
      CloseAll(0);
     }

   if(buy>0)
     {
      CloseAll(1);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
  {
   bool cl;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==0 && (ot==0 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slip,White);
              }
            if(OrderType()==1 && (ot==1 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slip,White);
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;
   double lotstep=MarketInfo(Symbol(),MODE_LOTSTEP);
   double MinLot=MarketInfo(Symbol(),MODE_MINLOT);
   double MaxLot=MarketInfo(Symbol(),MODE_MAXLOT);
   if(Lots==0) lot=AccountBalance()/100000*Risk;
   lot=NormalizeDouble(lot/lotstep,0)*lotstep;
   if(lot<MinLot) lot=MinLot;
   if(lot>MaxLot) lot=MaxLot;
   return(lot);
  }
  //+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double LastPrice()
  {
   double lp=0;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) lp=OrderOpenPrice();
            break;
           }
        }
     }
   return(lp);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int LastType()
  {
   int tp=8;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2) tp=OrderType();
            break;
           }
        }
     }
   return(tp);
  }
//+------------------------------------------------------------------+
//| OnTick function                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   double buy=iCustom(NULL,0,IndName,SignalPeriod,ArrowPeriod,2,Shift);
   double sell=iCustom(NULL,0,IndName,SignalPeriod,ArrowPeriod,3,Shift);
     
   if((CountTrades()<1 && buy>0 && Buy)  || (CountTrades()<Orders && LastType()==0 && Bid-LastPrice()>Step*Point)) PutOrder(0,Ask);
   if((CountTrades()<1 && sell>0 && Sell) || (CountTrades()<Orders && LastType()==1 && LastPrice()-Bid>Step*Point)) PutOrder(1,Bid);

   if(CloseSig>0) ClosePos();
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 19 сентября 2017, 02:04
0
Сейчас есть все кроме общего профита: www.opentraders.ru/downloads/1659/



avatar

AM2

  • 19 сентября 2017, 01:42
Начать торговлю с Альпари