donchian breakout modified by yogi
Похожие материалы по тегам
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «donchian breakout modified by yogi.mq5» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Индикатор рассчитывает каналы на основе ценовых данных с настраиваемым периодом и типом цены, включая варианты Heikin Ashi. При смене тренда отрисовывает на графике стрелки, прямоугольники и текстовые метки, отображающие точки входа и выхода в условных длинных и коротких позициях.
Встроена система отслеживания профита: индикатор ведёт учёт прибыльных и убыточных сделок, рассчитывает коэффициент прибыльности и при необходимости выводит статистику в виде комментария на графике. Доступны настраиваемые цвета для обозначения выигрышных и проигрышных сделок.
Поддерживаются уведомления о смене тренда через звуковые сигналы, электронную почту и push-уведомления MetaTrader. Звуковые оповещения могут повторяться заданное количество раз с настраиваемой паузой. Сдвиг алерта позволяет выбирать текущий или предыдущий бар для проверки условий.
Настройки программы
| Настройка | Описание |
|---|---|
| UniqueName | Уникальное имя — Уникальный текстовый идентификатор для именования графических объектов индикатора на графике. |
| Price | Тип цены — Тип цены для расчёта: Close, Median, Typical, Weighted Close или варианты Heikin Ashi. |
| ChannelPeriod | Период канала — Начальный период расчёта канала (целое число). |
| MaxChannelPeriod | Максимальный период канала — Максимальный период поиска канала при расширении (целое число). |
| Margin | Отступ канала — Числовой параметр, уменьшающий ширину канала на заданную долю (типа double). |
| MinChannelWidth | Минимальная ширина канала — Минимальная допустимая ширина канала в пунктах (типа double). |
| UpTrendColor | Цвет восходящего тренда — Цвет отображения восходящего тренда и связанных графических элементов. |
| DnTrendColor | Цвет нисходящего тренда — Цвет отображения нисходящего тренда и связанных графических элементов. |
| ShowFilledBoxes | Показать залитые прямоугольники — Отображает или скрывает залитые прямоугольники между границами канала при смене тренда. |
| ShowChannel | Показать канал — Отображает или скрывает линии верхней и нижней границы канала. |
| AnalysisSets | Наборы анализа — Текстовый параметр, задающий заголовок блока аналитических настроек. |
| ShowAnalysis | Показать анализ — Отображает или скрывает аналитические объекты (стрелки открытия, трендовые линии) на графике. |
| ShowStatsComment | Показать статистику — Выводит или скрывает комментарий со статистикой сделок на графике. |
| ShowArrows | Показать стрелки — Отображает или скрывает стрелки на графике, обозначающие точки входа и выхода. |
| ShowProfit | Показать прибыль — Отображает или скрывает текстовые метки с прибыльностью каждой сделки. |
| ShowExits | Показать выходы — Отображает или скрывает буферные значения точек выхода из позиций. |
| WinColor | Цвет прибыли — Цвет для обозначения прибыльных сделок на графике. |
| LossColor | Цвет убытка — Цвет для обозначения убыточных сделок на графике. |
| alerts | Настройки уведомлений — Текстовый параметр, задающий заголовок блока настроек уведомлений. |
| AlertOn | Включить алерты — Включает или отключает звуковые уведомления при смене тренда. |
| Alert Shift:0-current bar,1-previous bar (AlertShift) | Сдвиг алерта — Сдвиг бара для проверки условий алерта: 0 — текущий бар, 1 — предыдущий. |
| Number of sounds after Signal (SoundsNumber) | Количество звуков — Количество звуковых сигналов, воспроизводимых после получения сигнала. |
| Pause in sec between sounds (SoundsPause) | Пауза между звуками — Пауза в секундах между повторными звуковыми сигналами. |
| UpTrendSound | Звук восходящего тренда — Звуковой файл, воспроизводимый при сигнале о восходящем тренде. |
| DnTrendSound | Звук нисходящего тренда — Звуковой файл, воспроизводимый при сигнале о нисходящем тренде. |
| EmailOn | Включить email-уведомления — Включает или отключает отправку электронной почты при смене тренда. |
| EmailsNumber | Количество писем — Количество писем, отправляемых при одном сигнале. |
| PushNotificationOn | Включить push-уведомления — Включает или отключает push-уведомления при смене тренда. |
Поиск по коду файла
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 clrLimeGreen
#property indicator_color2 clrCoral
#property indicator_color3 clrGreen
#property indicator_color4 clrFireBrick
#property indicator_color5 clrLimeGreen
#property indicator_color6 clrCoral
enum ENUM_PRICE
{
close, // Close
median, // Median
typical, // Typical
weightedClose, // Weighted Close
heikenAshiClose, // Heiken Ashi Close
heikenAshiMedian, // Heiken Ashi Median
heikenAshiTypical, // Heiken Ashi Typical
heikenAshiWeighted // Heiken Ashi Weighted Close
};
input string UniqueName = "DonchianBrk";
input ENUM_PRICE Price = heikenAshiClose;
input int ChannelPeriod = 5;
input int MaxChannelPeriod = 30;
input double Margin = 0;
input double MinChannelWidth = 10;
input color UpTrendColor = clrDodgerBlue;
input color DnTrendColor = clrLightCoral;
input bool ShowFilledBoxes = true;
input bool ShowChannel = true;
input string AnalysisSets = "=== Trade Analysis ===";
input bool ShowAnalysis = false;
input bool ShowStatsComment = false;
input bool ShowArrows = true;
input bool ShowProfit = false;
input bool ShowExits = false;
input color WinColor = clrLimeGreen;
input color LossColor = clrTomato;
input string alerts = "==== Alerts & Emails: ====";
input bool AlertOn = false; //
input int AlertShift = 1; // Alert Shift:0-current bar,1-previous bar
input int SoundsNumber = 5; // Number of sounds after Signal
input int SoundsPause = 5; // Pause in sec between sounds
input string UpTrendSound = "alert.wav";
input string DnTrendSound = "alert2.wav";
input bool EmailOn = false; //
input int EmailsNumber = *; //
input bool PushNotificationOn = false;
double UpSignal[];
double DnSignal[];
double UpBand[];
double LoBand[];
double buyexit[];
double sellexit[];
double trend[];
double buycnt[];
double sellcnt[];
double pf[];
int timeframe, buylosscnt[2], selllosscnt[2];
bool buystop[2], sellstop[2];
double _point, buyopen[], buyclose[], sellopen[], sellclose[], lobound, upbound, totbuyprofit[2], totsellprofit[2], totbuyloss[2], totsellloss[2];
datetime buyopentime[], buyclosetime[], sellopentime[], sellclosetime[], prevtime;
string short_name, TF, IndicatorName;
int OnInit()
{
// код доступен только после оплаты
}
void OnDeinit(const int reason)
{
Comment("");
ObjectsDeleteAll(0,UniqueName);
ChartRedraw();
}
int start()
{
// код доступен только после оплаты
}
int shift, limit, counted_bars = IndicatorCounted();
double buyprofit, sellprofit;
if(counted_bars > 0) limit = Bars - counted_bars - 1;
if(counted_bars < 0) return(0);
if(counted_bars < 1)
{
limit = Bars - 1;
for(int i=limit;i>=0;i--)
{
UpBand[i] = EMPTY_VALUE;
LoBand[i] = EMPTY_VALUE;
UpSignal[i] = EMPTY_VALUE;
DnSignal[i] = EMPTY_VALUE;
buyexit[i] = 0;
sellexit[i] = 0;
}
}
for(shift=limit; shift>=0; shift--)
{
if(Time[shift] != prevtime)
{
buystop[1] = buystop[0];
sellstop[1] = sellstop[0];
prevtime = Time[shift];
}
int maxperiod = MaxChannelPeriod;
int hhbar = iHighest(NULL,0,MODE_HIGH,ChannelPeriod,shift);
int llbar = iLowest (NULL,0,MODE_LOW ,ChannelPeriod,shift);
double hh = High[hhbar];
double ll = Low [llbar];
double width = (hh - ll)*(1 - 2*Margin);
if(shift > Bars - maxperiod) continue;
if(width < MinChannelWidth*_point)
{
for(i=ChannelPeriod+1;i<=maxperiod;i++)
{
hhbar = iHighest(NULL,0,MODE_HIGH,i,shift);
llbar = iLowest (NULL,0,MODE_LOW ,i,shift);
hh = High[hhbar];
ll = Low [llbar];
width = (hh - ll)*(1 - 2*Margin);
if(width >= MinChannelWidth*_point) break;
else
{
if(i >= maxperiod && shift + i < Bars - 2) maxperiod = maxperiod + 1;
else
continue;
}
}
}
UpBand[shift] = hh - width*Margin;
LoBand[shift] = ll + width*Margin;
trend[shift] = trend[shift+1];
if(priceWrapper(Price,shift) > UpBand[shift+1]) trend[shift] = 1;
if(priceWrapper(Price,shift) < LoBand[shift+1]) trend[shift] =-1;
if(trend[shift+1] != trend[shift+2])
{
if(trend[shift+1] > 0) {totsellprofit[1] = totsellprofit[0]; totsellloss[1] = totsellloss[0]; selllosscnt[1] = selllosscnt[0];}
if(trend[shift+1] < 0) {totbuyprofit[1] = totbuyprofit[0]; totbuyloss[1] = totbuyloss[0]; buylosscnt[1] = buylosscnt[0];}
}
UpSignal[shift] = EMPTY_VALUE;
DnSignal[shift] = EMPTY_VALUE;
buycnt[shift] = buycnt[shift+1];
sellcnt[shift] = sellcnt[shift+1];
buyexit[shift] = 0;
sellexit[shift] = 0;
buystop[0] = buystop[1];
sellstop[0] = sellstop[1];
if(trend[shift] > 0)
{
if(trend[shift+1] <= 0)
{
lobound = MathMin(LoBand[llbar],LoBand[MathMax(llbar,shift+ChannelPeriod)]);
if(UpBand[shift+1] > 0 && UpBand[shift+1] != EMPTY_VALUE && lobound > 0 && lobound != EMPTY_VALUE)
{
SetBox(UniqueName+" UpBox "+TimeToString(Time[shift]),0,Time[shift],UpBand[shift+1],Time[MathMax(llbar,shift+ChannelPeriod)],lobound,ShowFilledBoxes,clrNONE,1,UpTrendColor,1);
UpSignal[shift] = lobound;
if(ShowAnalysis)
{
buycnt[shift] = buycnt[shift+1] + 1;
ArrayResize(buyopen ,buycnt[shift]);
ArrayResize(buyclose,buycnt[shift]);
ArrayResize(buyopentime ,buycnt[shift]);
ArrayResize(buyclosetime,buycnt[shift]);
buyopen[(int)buycnt[shift]-1] = Close[shift];
buyopentime[(int)buycnt[shift]-1] = Time[shift];
buyclose[(int)buycnt[shift]-1] = buyopen[(int)buycnt[shift]-1];
buystop[0] = false;
if(ShowArrows)
{
ObjectDelete(UniqueName+" BuyOpen "+DoubleToStr(buycnt[shift],0));
plotArrow(UniqueName+" BuyOpen "+DoubleToStr(buycnt[shift],0),buyopentime[(int)buycnt[shift]-1],buyopen[(int)buycnt[shift]-1],1,UpTrendColor);
}
}
}
if(High[shift] >= upbound && !sellstop[0] && sellclose[(int)sellcnt[shift]-1] == sellopen[(int)sellcnt[shift]-1])
{
sellclose[(int)sellcnt[shift]-1] = upbound;
sellclosetime[(int)sellcnt[shift]-1] = Time[shift];
sellstop[0] = true;
if(sellopentime[(int)sellcnt[shift]-1] > 0 && sellclosetime[(int)sellcnt[shift]-1] > 0)
{
if(sellclose[(int)sellcnt[shift]-1] <= sellopen[(int)sellcnt[shift]-1]) color sellcolor = WinColor; else sellcolor = LossColor;
plotTrend(UniqueName+" SellTrend "+DoubleToStr(sellcnt[shift],0),sellopentime[(int)sellcnt[shift]-1],sellopen[(int)sellcnt[shift]-1],sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],2,0,sellcolor);
if(ShowArrows && trend[shift+1] < 0) plotArrow(UniqueName+" SellClose "+DoubleToStr(sellcnt[shift],0),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],3,DnTrendColor);
if(ShowExits) sellexit[shift] = sellclose[(int)sellcnt[shift]-1];
}
if(ShowProfit)
{
sellprofit = (sellopen[(int)sellcnt[shift]-1] - sellclose[(int)sellcnt[shift]-1])/_point;
if(sellprofit >= 0) totsellprofit[0] = totsellprofit[1] + sellprofit;
else
{
totsellloss[0] = totsellloss[1] - sellprofit;
selllosscnt[0] = selllosscnt[1] + 1;
}
ObjectDelete(0,UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0));
if(sellprofit >= 0) plotText(UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0),0,"+"+DoubleToStr(sellprofit,1),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],ANCHOR_RIGHT_UPPER,WinColor,"Arial",8);
else plotText(UniqueName+" SellProfit "+DoubleToStr(sellcnt[shift],0),0,DoubleToStr(sellprofit,1),sellclosetime[(int)sellcnt[shift]-1],sellclose[(int)sellcnt[shift]-1],ANCHOR_RIGHT_LOWER,LossColor,"Arial",8);
}
}
}
ObjectDelete(0,UniqueName+" DnBox "+TimeToString(Time[shift]));
if(ShowAnalysis)
{
if(trend[shift+1] > 0)
{
if(High[shift] > buyclose[(int)buycnt[shift]-1] && !buystop[0])
{
buyclose[(int)buycnt[shift]-1] = High[shift];
buyclosetime[(int)buycnt[shift]-1] = Time[shift];
}
if(Low[shift] <= lobound && !buystop[0] && buyclose[(int)buycnt[shift]-1] == buyopen[(int)buycnt[shift]-1])
{
buyclose[(int)buycnt[shift]-1] = lobound;
buyclosetime[(int)buycnt[shift]-1] = Time[shift];
buystop[0] = true;
}
}
ObjectDelete(0,UniqueName+" BuyTrend "+DoubleToStr(buycnt[shift],0));
if(ShowArrows) ObjectDelete(0,UniqueName+" BuyClose "+DoubleToStr(buycnt[shift],0));
if(buyopentime[(int)buycnt[shift]-1] > 0 && buyclosetime[(int)buycnt[shift]-1] > 0)
{
if(buyclose[(int)buycnt[shift]-1] >= buyopen[(int)buycnt[shift]-1]) color buycolor = WinColor; else buycolor = LossColor;
plotTrend(UniqueName+" BuyTrend "+DoubleToStr(buycnt[shift],0),buyopentime[(int)buycnt[shift]-1],buyopen[(int)buycnt[shift]-1],buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],2,0,buycolor);
if(ShowArrows && trend[shift+1] > 0) plotArrow(UniqueName+" BuyClose "+DoubleToStr(buycnt[shift],0),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],3,UpTrendColor);
if(ShowExits) buyexit[shift] = buyclose[(int)buycnt[shift]-1];
}
if(ShowProfit)
{
buyprofit = (buyclose[(int)buycnt[shift]-1] - buyopen[(int)buycnt[shift]-1])/_point;
if(buyprofit >= 0) totbuyprofit[0] = totbuyprofit[1] + buyprofit;
else
{
totbuyloss[0] = totbuyloss[1] - buyprofit;
buylosscnt[0] = buylosscnt[1] + 1;
}
ObjectDelete(0,UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0));
if(buyprofit >= 0) plotText(UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0),0,"+"+DoubleToStr(buyprofit,1),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],ANCHOR_RIGHT_LOWER,WinColor,"Arial",8);
else plotText(UniqueName+" BuyProfit "+DoubleToStr(buycnt[shift],0),0,DoubleToStr(buyprofit,1),buyclosetime[(int)buycnt[shift]-1],buyclose[(int)buycnt[shift]-1],ANCHOR_RIGHT_UPPER,LossColor,"Arial",8);
}
if(ShowArrows)
if(ObjectGetInteger(0,UniqueName+" SellOpen "+DoubleToStr(sellcnt[shift]+1,0),OBJPROP_TIME) == Time[shift]) ObjectDelete(0,UniqueName+" SellOpen "+DoubleToStr(sellcnt[shift]+1,0));
}
}
if(trend[shift] < 0)
{
if(trend[shift+1] >= 0)
{
upbound = MathMax(UpBand[hhbar],UpBand[MathMax(hhbar,shift+ChannelPeriod)]); //High[iHighest(NULL,0,MODE_HIGH,MathMax(hhbar - shift,ChannelPeriod),shift+1)];
if(LoBand[shift+1] > 0 && LoBand[shift+1] != EMPTY_VALUE && upbound > 0 && upbound != EMPTY_VALUE)
{
SetBox(UniqueName+" DnBox "+TimeToString(Time[shift]),0,Time[shift],LoBand[shift+1],Time[MathMax(hhbar,shift+ChannelPeriod)],upbound,ShowFilledBoxes,clrNONE,1,DnTrendColor,1);
DnSignal[shift] = upbound;
if(ShowAnalysis)
{
sellcnt[shift] = sellcnt[shift+1] + 1;
ArrayResize(sellopen ,sellcnt[shift]);
ArrayResize(sellclose,sellcnt[shift]);
ArrayResize(sellopentime ,sellcnt[shift]);
ArrayResize(sellclosetime,sellcnt[shift]);
sellopen[(int)sellcnt[shift]-1] = Close[shift];
sellopentime[(int)sellcnt[shift]-1] = Time[shift];
sellclose[(int)sellcnt[shift]-1] = sellopen[(int)sellcnt[shift]-1];
sellstop[0] = false;
Показано первые 50% кода (символов: 21339)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.