0
Качнуть то в базе можно, но индикатор сыпет множественные закрытия, на каком бы я баре не брал сигнал.

avatar

AM2

  • 3 марта 2016, 19:55
0
В советнике 5 типов закрытия. По тейку, стопу, лось в процентах от депо, язь в процентах от депо и по профиту в валюте. Последние 3 можно отключить поставив эти значения в 0.


extern int    EquityRisk   = 0;  //Стоп по средствам в %
extern int    EquityProfit = 0;  //Тейк по средствам в %
extern int    Profit       = 0;  //Профит в долларах
avatar

AM2

  • 3 марта 2016, 19:34
0
Больше половины функций я добавил, дальше вечером продолжу.

avatar

AM2

  • 3 марта 2016, 12:26
0
Редко но бывает, на скрине выше это видно.
avatar

AM2

  • 3 марта 2016, 10:41
0
Я сейчас смотрел и на закрытом баре бывает тоже 2 точки.
avatar

AM2

  • 3 марта 2016, 09:43
0
Андрей немножечко не так сигнал на покупку или продажу когда два индикатора точнее начало индикаторов появляються в одной точке наодной свече или между двумя свечами также начало индюков может немножечко сдинуты

На сколько баров туда сюда проверять сдвиг сигналов?
avatar

AM2

  • 3 марта 2016, 09:36
0
Осталось только фибо под волны подстроить

Напишите подробнее, посмотрим что можно сделать.
avatar

AM2

  • 3 марта 2016, 09:30
0
Когда большой объем делаю в упрощенном варианте, за платные не берусь. Если нужно точное соответствие ТЗ, обращайтесь сразу к платному. На баре бывает по 2 точки сразу. Какой тогда будет вход?

avatar

AM2

  • 3 марта 2016, 09:03
0
Пересекли 50 вниз байстоп вверх селлстоп:




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

//--- Inputs
extern int    StopLoss    = 500; //лось
extern int    TakeProfit  = 500; //язь
extern int    Delta       = 100; //проход цены 
extern int    Slip        = 10;  //проскальзывание
extern int    Expiration  = 10;  //время истечения ордера
extern int    Magic       = 123; //магик
extern double Lots        = 1;   //лот

int cross=0;
//+------------------------------------------------------------------+
//| 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=clrNONE;
   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,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,TimeCurrent()+Expiration*3600,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountOrders(int type)
  {
   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()==type) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Cоздает "Уровни Фибоначчи" по заданным координатам               |
//+------------------------------------------------------------------+
void FiboLevelsCreate(datetime t1,double p1,datetime t2,double p2)
  {
   ObjectsDeleteAll(0,OBJ_FIBO);
//--- создадим "Уровни Фибоначчи" по заданным координатам
   ObjectCreate(0,"FiboLevels",OBJ_FIBO,0,t1,p1,t2,p2);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CrossUP(double p)
  {
   int res=0;
   if(Open[0]<p && Bid-p>=Delta*Point) res=1;
   return(res);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CrossDN(double p)
  {
   int res=0;
   if(Open[0]>p && p-Bid>=Delta*Point) res=1;
   return(res);
  }  
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(IsTesting())
     {
      double up=iHigh(NULL,PERIOD_D1,1);
      double dn=iLow(NULL,PERIOD_D1,1);
      FiboLevelsCreate(Time[1],up,Time[15],dn);
     }

   string name="FiboLevels";
/*   
   for(int i=ObjectsTotal()-1;  i>=0;  i--)
     {
      name=ObjectName(i);
     }
*/
   double F = ObjectGet(name, OBJPROP_PRICE1);
   double S = ObjectGet(name, OBJPROP_PRICE2);

   double p0=NormalizeDouble(S,Digits);
   double p100 = NormalizeDouble(F, Digits);
   double p236 = NormalizeDouble((F-S)*0.236+S, Digits);
   double p382 = NormalizeDouble((F-S)*0.382+S, Digits);
   double p50=NormalizeDouble((F-S)*0.50+S,Digits);
   double p618=NormalizeDouble((F-S)*0.618+S,Digits);

   if(High[1]>p50 && Low[1]<p50) cross=1;
   if(Hour()==5) cross=0;

   if(CountTrades()<1)
     {
      if(CountOrders(4)<1 && CrossDN(p50)==1) PutOrder(4,p50);
      if(CountOrders(5)<1 && CrossUP(p50)==1) PutOrder(5,p50);
     }

   Comment("\n Fibo 100: ",p100,
           "\n Fibo 0: ",p0,
           "\n Fibo 236: ",p236,
           "\n Fibo 382: ",p382,
           "\n Fibo 50: ",p50,
           "\n Fibo 618: ",p618,
           "\n Name: ",name,
           "\n Cross: ",cross,
           "\n CrossUP: ",CrossUP(p50),
           "\n CrossDN: ",CrossDN(p50));
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 3 марта 2016, 08:35
0
На самом деле все простенько. 1 — фильтр, 1 точка входа, а дальше как и у всех советников ММ, профит, стоплосс…


Как этот так и прошлый заказ на платном будут от 50$ и вы это прекрасно знаете.
avatar

AM2

  • 3 марта 2016, 01:02
0
Мое видение этого ТЗ:

Входы:

1. Покупка: индикатор Ozy меняет цвет с красного на синий + индикатор BBands_Stop_v1 меняет цвет с красного на синий.
2. Продажа: индикатор BBands_Stop_v1 меняет цвет с синего на красный + индикатор BBands_Stop_v1 меняет цвет с синего на красный.

Выходы:

1. Из покупки: индикатор BBands_Stop_v1 меняет цвет с синего на красный + индикатор BBands_Stop_v1 меняет цвет с синего на красный.
2. Из продажи: индикатор Ozy меняет цвет с красного на синий + индикатор BBands_Stop_v1 меняет цвет с красного на синий.

Если так, я сделал еще и таким образом, но сигналы очень редкие.
www.opentraders.ru/downloads/1080/
avatar

AM2

  • 3 марта 2016, 00:16
+1
Это только набросок, позже буду делать ближе к ТЗ.
avatar

AM2

  • 3 марта 2016, 00:13
0
Я как то пробовал, до сих пор кондратий вздрагивает :D 
avatar

AM2

  • 3 марта 2016, 00:06
0
Сортировку ордеров и потом работу с тикетами никогда не делал честно признаюсь :) 
avatar

AM2

  • 2 марта 2016, 22:19
0
Бесплатно за заказ мало кто берется. Заказы трейдерам от 3-го рассмотрю в группе стол заказов.
avatar

AM2

  • 2 марта 2016, 21:46
0
Сделал основу для советника. Если цена выше 50 на дельта пунктов ставим селлстоп, ниже бай. Фибо ставится на хай лоу предыдущего дня. Смотрите пишите что исправит добавить.




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

//--- Inputs
extern double StopLoss    = 500; //лось
extern double TakeProfit  = 500; //язь
extern int    Delta       = 100; //проход цены 
extern int    Slip        = 10;  //проскальзывание
extern int    Expiration  = 10;  //время истечения ордера
extern int    Magic       = 123; //магик
extern double Lots        = 1;   //лот
//+------------------------------------------------------------------+
//| 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=clrNONE;
   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,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,TimeCurrent()+Expiration*3600,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountOrders(int type)
  {
   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()==type) count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//| Cоздает "Уровни Фибоначчи" по заданным координатам               |
//+------------------------------------------------------------------+
void FiboLevelsCreate(datetime t1,double p1,datetime t2,double p2)
  {
   ObjectsDeleteAll(0,OBJ_FIBO);
//--- создадим "Уровни Фибоначчи" по заданным координатам
   ObjectCreate(0,"FiboLevels",OBJ_FIBO,0,t1,p1,t2,p2);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(IsTesting())
     {
      double up=iHigh(NULL,PERIOD_D1,1);
      double dn=iLow(NULL,PERIOD_D1,1);
      FiboLevelsCreate(Time[1],up,Time[15],dn);
     }

   string name="FiboLevels";
/*   
   for(int i=ObjectsTotal()-1;  i>=0;  i--)
     {
      name=ObjectName(i);
     }
*/
   double F = ObjectGet(name, OBJPROP_PRICE1);
   double S = ObjectGet(name, OBJPROP_PRICE2);

   double p0 = NormalizeDouble(S, Digits);
   double p100 = NormalizeDouble(F, Digits);
   double p236 = NormalizeDouble((F-S)*0.236+S, Digits);
   double p382 = NormalizeDouble((F-S)*0.382+S, Digits);
   double p50 = NormalizeDouble((F-S)*0.50+S, Digits);
   double p618 = NormalizeDouble((F-S)*0.618+S, Digits);

   if(CountTrades()<1)
     {
      if(CountOrders(4)<1 && p50-Bid>=Delta*Point) PutOrder(4,p50);
      if(CountOrders(5)<1 && Bid-p50>=Delta*Point) PutOrder(5,p50);
     }

   Comment("\n Fibo 100: ",p100,
           "\n Fibo 0: ",p0,
           "\n Fibo 236: ",p236,
           "\n Fibo 382: ",p382,
           "\n Fibo 50: ",p50,
           "\n Fibo 618: ",p618,
           "\n Name: ",name);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 2 марта 2016, 21:38
+1
Сейчас похоже на правду? :) 




//+------------------------------------------------------------------+
//|                                                         Bozy.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+

#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots       = 0.1;      // лот
extern double KLot       = 2;        // умножение лота
extern double MaxLot     = 5;        // максимальный лот
extern int StopLoss      = 2000;     // лось
extern int TakeProfit    = 300;      // язь
extern int TrailingStop  = 300;      // трал
extern int Slip          = 30;       // реквот
extern int Shift         = 1;        // сдвиг
extern int Magic         = 123;      // магик
extern string IndName1="BBands_Stop_v1";
extern string s="     ------ BBands_Stop_v1 -----";
extern int    Length=20;      // Bollinger Bands Period
extern int    Deviation=2;    // Deviation was 2
extern string IndName2="Ozy";
extern string ss="     ------ Ozy -----";
extern int Period_1 = 2;
extern int Period_2 = 2;
extern string sss="     ------------- Настройки MACD ------------- ";
extern int    MACD         = 0;    // 0-выкл. 1-вкл.
extern int    Fast         = 12;   // 
extern int    Slow         = 26;   // 
extern int    Signal       = 9;    // 

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OpenPos()
  {
   bool buy,sell;
   double BBBlue=iCustom(NULL,0,IndName1,Length,Deviation,0,Shift);
   double BBRed=iCustom(NULL,0,IndName1,Length,Deviation,1,Shift);
   double BBBlue2=iCustom(NULL,0,IndName1,Length,Deviation,0,Shift+1);
   double BBRed2=iCustom(NULL,0,IndName1,Length,Deviation,1,Shift+1);   
   double OzyBlue=iCustom(NULL,0,IndName2,Period_1,Period_2,0,Shift);
   double OzyRed=iCustom(NULL,0,IndName2,Period_1,Period_2,1,Shift);
   double macd=iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,Shift);

   if(MACD==0)
     {
      buy  = BBBlue>0 && BBRed2>0 && OzyBlue>0;
      sell = BBRed>0  && BBBlue2>0 && OzyRed>0;
     }

   if(MACD==1)
     {
      buy  = BBBlue>0 && OzyBlue>0  && BBRed2>0 && macd>0;
      sell = BBRed>0  && OzyRed>0  && BBBlue2>0 && macd<0;
     }

//--- sell conditions
   if(sell)
     {
      PutOrder(1,Bid);
     }
//--- buy conditions
   if(buy)
     {
      PutOrder(0,Ask);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ClosePos()
  {
   bool buy,sell;
   double BBBlue=iCustom(NULL,0,IndName1,Length,Deviation,0,Shift);
   double BBRed=iCustom(NULL,0,IndName1,Length,Deviation,1,Shift);
   double BBBlue2=iCustom(NULL,0,IndName1,Length,Deviation,0,Shift+1);
   double BBRed2=iCustom(NULL,0,IndName1,Length,Deviation,1,Shift+1);   
   double OzyBlue=iCustom(NULL,0,IndName2,Period_1,Period_2,0,Shift);
   double OzyRed=iCustom(NULL,0,IndName2,Period_1,Period_2,1,Shift);
   double macd=iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,Shift);

   if(MACD==0)
     {
      buy  = BBBlue>0 && BBRed2>0 && OzyBlue>0;
      sell = BBRed>0  && BBBlue2>0 && OzyRed>0;
     }

   if(MACD==1)
     {
      buy  = BBBlue>0 && OzyBlue>0  && BBRed2>0 && macd>0;
      sell = BBRed>0  && OzyRed>0  && BBBlue2>0 && macd<0;
     }
     
//---
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(sell)
                 {
                  if(!OrderClose(OrderTicket(),OrderLots(),Bid,Slip,White))
                     Print("OrderClose error ",GetLastError());
                 }
              }
            if(OrderType()==OP_SELL)
              {
               if(buy)
                 {
                  if(!OrderClose(OrderTicket(),OrderLots(),Ask,Slip,White))
                     Print("OrderClose error ",GetLastError());
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;

   if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
     {
      if(OrderProfit()<0)
        {
         lot=OrderLots()*KLot;
        }
     }
   if(lot>MaxLot)lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Trailing()
  {
   bool mod;
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() || OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(Bid-OrderOpenPrice()>TrailingStop*Point)
                 {
                  if(OrderStopLoss()<Bid-TrailingStop*Point)
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if((OrderOpenPrice()-Ask)>TrailingStop*Point)
                 {
                  if((OrderStopLoss()>(Ask+TrailingStop*Point)) || (OrderStopLoss()==0))
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double BBBlue=iCustom(NULL,0,IndName1,Length,Deviation,0,Shift);
   double BBRed=iCustom(NULL,0,IndName1,Length,Deviation,1,Shift);
   double OzyBlue=iCustom(NULL,0,IndName2,Period_1,Period_2,0,Shift);
   double OzyRed=iCustom(NULL,0,IndName2,Period_1,Period_2,1,Shift);
   double macd=iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,Shift);

   if(CountTrades()<1)
     {
      OpenPos();
     }
   else ClosePos();

   if(TrailingStop>0) Trailing();

   Comment("\n OzyBlue: ",OzyBlue,
           "\n OzyRed:  ",OzyRed);
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 2 марта 2016, 20:32
0
У вас заказы с очень приличным объемом работы. Когда будет свободное время буду смотреть.
avatar

AM2

  • 2 марта 2016, 18:50
0
условия входа если на одной свече совпадают два сигнала индикаторов BBands_Stop_v1 и Ozy как на скрине


По ТЗ вход при совпадении сигналов на индикаторах, почему тогда неверный вход?
avatar

AM2

  • 2 марта 2016, 18:26
0
Оксана, я перепробовал разные варианты. Свойство OBJPROP_LEVELVALUE выдает 0.236 или 0.628 но не цену уровня. В результате вручную пришлось считать.
avatar

AM2

  • 2 марта 2016, 18:15