Раздел «Маркет» всегда был и остается для меня неиссякаемым источником идей и торговых систем, многие из которых проверены на реальных счетах.
Сегодня рассмотрим советник «YPY EA Tekvilidy ELITE»:
www.mql5.com/ru/market/product/10460
Мониторинг эксперта:
www.mql5.com/ru/signals/150941
Скачаем советник и посмотрим сделки:
1. Открытие при повышенной волатильности.
2. Стопы также ставятся в зависимости от изменения цены.
3. Разные уровни ТП.
4. Открытие серий ордеров с разными магиками.
5. Закрытие через определенное время.
6. Модификация ТП. Идет не трал, а уменьшение уровня ТП через некоторое количество баров.
7. И др.
Сделаем самый примитивный вариант. Покупать будем если предыдущая свеча превысила указанное количество пунктов, т.о. и продажи. Торгуем на открытии свечи с фиксированными стопами.
//+------------------------------------------------------------------+
//| Tekvilidy.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 int StopLoss = 150; // лось
extern int TakeProfit = 150; // язь
extern int Points = 100; // волатильность
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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,Lots,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);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double vbuy=(Close[1]-Open[1])/Point;
double vsell=(Open[1]-Close[1])/Point;
if(t!=Time[0])
{
if(vbuy>Points)
{
if(CountTrades()<1)PutOrder(0,Ask);
}
if(vsell>Points)
{
if(CountTrades()<1)PutOrder(1,Bid);
}
}
Comment("\n Vol Buy: ",vbuy,
"\n Vol Sell: ",vsell);
}
//+------------------------------------------------------------------+
После оптимизации эксперта за 5 лет на М15, получаем следующую картинку. По кривой баланса можно увидеть что есть определенная закономерность в нашей ТС.
Добавим в советник дополнительный ТП и второй ордер:
//+------------------------------------------------------------------+
//| Tekvilidy.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 int StopLoss = 150; // лось
extern int TakeProfit = 150; // язь
extern int TakeProfit2 = 150; // язь
extern int Points = 100; // волатильность
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder2(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-TakeProfit2*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+TakeProfit2*Point,Digits);
}
r=OrderSend(NULL,type,Lots,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);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double vbuy=(Close[1]-Open[1])/Point;
double vsell=(Open[1]-Close[1])/Point;
if(t!=Time[0])
{
if(vbuy>Points)
{
if(CountTrades()<1)
{
PutOrder(0,Ask);
PutOrder2(0,Ask);
}
}
if(vsell>Points)
{
if(CountTrades()<1)
{
PutOrder(1,Bid);
PutOrder2(1,Bid);
}
}
}
Comment("\n Vol Buy: ",vbuy,
"\n Vol Sell: ",vsell);
}
//+------------------------------------------------------------------+
C двумя ордерами увеличивается просадка:
Добавим в советник следующий пункт — закрытие по барам:
//+------------------------------------------------------------------+
//| Tekvilidy.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 int StopLoss = 150; // лось
extern int TakeProfit = 150; // язь
extern int TakeProfit2 = 150; // язь
extern int BarsClose = 20; // закрытие по барам
extern int Points = 100; // волатильность
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
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,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder2(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-TakeProfit2*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+TakeProfit2*Point,Digits);
}
r=OrderSend(NULL,type,Lots,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);
}
//+------------------------------------------------------------------+
//| Время открытия позиции |
//+------------------------------------------------------------------+
datetime TimeOrderOpen()
{
datetime tm=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) tm=OrderOpenTime();
}
}
}
return(tm);
}
//+------------------------------------------------------------------+
//| Закрытие позиции по типу ордера |
//+------------------------------------------------------------------+
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);
}
}
}
}
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double vbuy=(Close[1]-Open[1])/Point;
double vsell=(Open[1]-Close[1])/Point;
if(t!=Time[0])
{
if(vbuy>Points)
{
if(CountTrades()<1)
{
PutOrder(0,Ask);
PutOrder2(0,Ask);
}
}
if(vsell>Points)
{
if(CountTrades()<1)
{
PutOrder(1,Bid);
PutOrder2(1,Bid);
}
}
}
if(TimeCurrent()-TimeOrderOpen()>BarsClose*PeriodSeconds()) CloseAll();
Comment("\n Vol Buy: ",vbuy,
"\n Vol Sell: ",vsell);
}
//+------------------------------------------------------------------+
После оптимизации отметим, что после добавления функции немного уменьшилась просадка, т.к. позиция закрывается прежде чем уйти в минус:
Простым вводом стопов по АТР мы еще больше улучшим показатели системы:
//+------------------------------------------------------------------+
//| Tekvilidy.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 KATR = 0.0015; // ATR коэффициент
extern int StopLoss = 150; // лось
extern int TakeProfit = 150; // язь
extern int TakeProfit2 = 150; // язь
extern int BarsClose = 20; // закрытие по барам
extern int ATRPeriod = 14; // ATR период
extern int Points = 100; // волатильность
extern int Slip = 30; // реквот
extern int Magic = 123; // магик
datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Comment("");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
double katr=iATR(NULL,0,ATRPeriod,0)/KATR;
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(ATRPeriod>0)
{
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point*katr,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point*katr,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);
if(ATRPeriod>0)
{
if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point*katr,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point*katr,Digits);
}
}
r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,"",Magic,0,clr);
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutOrder2(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;
double katr=iATR(NULL,0,ATRPeriod,0)/KATR;
if(type==1 || type==3 || type==5)
{
clr=Red;
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit2*Point,Digits);
if(ATRPeriod>0)
{
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point*katr,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit2*Point*katr,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+TakeProfit2*Point,Digits);
if(ATRPeriod>0)
{
if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point*katr,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit2*Point*katr,Digits);
}
}
r=OrderSend(NULL,type,Lots,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);
}
//+------------------------------------------------------------------+
//| Время открытия позиции |
//+------------------------------------------------------------------+
datetime TimeOrderOpen()
{
datetime tm=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) tm=OrderOpenTime();
}
}
}
return(tm);
}
//+------------------------------------------------------------------+
//| Закрытие позиции по типу ордера |
//+------------------------------------------------------------------+
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);
}
}
}
}
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double vbuy=(Close[1]-Open[1])/Point;
double vsell=(Open[1]-Close[1])/Point;
if(t!=Time[0])
{
if(vbuy>Points)
{
if(CountTrades()<1)
{
PutOrder(0,Ask);
PutOrder2(0,Ask);
}
}
if(vsell>Points)
{
if(CountTrades()<1)
{
PutOrder(1,Bid);
PutOrder2(1,Bid);
}
}
}
if(TimeCurrent()-TimeOrderOpen()>BarsClose*PeriodSeconds()) CloseAll();
Comment("\n Vol Buy: ",vbuy,
"\n Vol Sell: ",vsell);
}
//+------------------------------------------------------------------+
При необходимости вы можете пользоваться промежуточными вариантами советника или можете обратиться в
«Стол Заказов MQL» и я внесу в советник небольшие изменения.
П.С. Чтобы получить советник стоимостью 4300 долларов, нужно вложить труда в разработку никак не менее указанной суммы. В этом топике только мое видение сделок плюс самые основные функции. Но даже в таком виде советник заслуживает внимания.
Скачать советник можно по ссылке:
www.opentraders.ru/downloads/1268/
Комментарии (19)
Больше всего понравилась настройка объем лота от уровня сигнала.
Прогнать бы хотя бы Ваш вариант с лотом от депо.
Решил тоже поиграть с Вашим вариантом на всех тиках с 02.2016 по сей день.
Итоги по фунту
Еврик чуть по хуже, но тоже отстоял не плохо.
13 Pesha Сообщений: 222 - ¯\_(ツ)_/¯
Для скептиков, все тики:
35 AM2 Автор Сообщений: 16507 - Андрей
8 WolfTraderS Сообщений: 142
35 AM2 Автор Сообщений: 16507 - Андрей
кто будет делать, не забудьте отключаемый лот в процентах первоначальный.
13 Pesha Сообщений: 222 - ¯\_(ツ)_/¯
Или так и задумано?
3 newpvr Сообщений: 17 - Павел
Именно в этом неточность, нужно просто добавить контроль свечи. Одну половину я добавил а другую на десерт оставил
35 AM2 Автор Сообщений: 16507 - Андрей
13 Pesha Сообщений: 222 - ¯\_(ツ)_/¯
19 lorik Сообщений: 357 - Лариса
35 AM2 Автор Сообщений: 16507 - Андрей
13 writelint00 Сообщений: 592 - writelint
3 Derimorda Сообщений: 10
13 Pesha Сообщений: 222 - ¯\_(ツ)_/¯
3 Derimorda Сообщений: 10
13 Pesha Сообщений: 222 - ¯\_(ツ)_/¯
27 Oxy Сообщений: 3430 - ..ιllιlι.lι.ιllι.ιlι..
20 Anatoly74 Сообщений: 3710 - Анатолий
46 Bishop Сообщений: 5816 - АЛЬФАХАМЕЦ-Машковод
P.S.
19 Kashtan Сообщений: 739 - Игорь
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий