macd-osma-on-chart-mtf-v2.mq5
Похожие материалы по тегам
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «macd-osma-on-chart-mtf-v2.mq5» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Данный продукт представляет собой пользовательский индикатор для MetaTrader 4, который рассчитывает и отображает на графике аналитические индикаторы MACD или OsMA. Режим расчёта выбирается пользователем через соответствующий параметр. Индикатор поддерживает многопериодной режим, позволяя отображать данные с выбранного таймфрейма на текущем графике.
Визуализация может быть настроена несколькими режимами отображения: цветные линии, цветные столбцы, их комбинации или точки. Доступны настраиваемые полосы верхней и нижней границы в пунктах, а также стрелки маркеры, указывающие на изменение направления тренда. Ширина линий и столбцов настраивается отдельно.
Индикатор включает систему уведомлений с поддержкой текстовых сообщений, звуковых сигналов, push-уведомлений и email-рассылки. Уведомления срабатывают при изменении направления тренда и могут настраиваться по отдельным каналам. Для многопериодного режима доступны методы интерполяции данных.
Настройки программы
| Настройка | Описание |
|---|---|
| Time frame (TimeFrame) | TimeFrame — Выбранный таймфрейм для расчёта и отображения индикатора |
| Custom time frame to use (if custom time frame used) (TimeFrameCustom) | TimeFrameCustom — Значение пользовательского таймфрейма (используется при выборе пользовательского таймфрейма) |
| Быстрая - Период (Fast) | Быстрая - Период — Период быстрой скользящей средней |
| Медленная - Период (Slow) | Медленная - Период — Период медленной скользящей средней |
| Сигнальная - Период (Signal) | Сигнальная - Период — Период сигнальной линии |
| Быстрая и Медленная - Метод (Mode) | Быстрая и Медленная - Метод — Метод расчёта скользящей средней для быстрой и медленной периодов |
| Быстрая и Медленная - Цена (Price) | Быстрая и Медленная - Цена — Тип цены для расчёта быстрой и медленной скользящих средних |
| en_lin; // Display type (DisplayType) | DisplayType — Режим отображения индикатора на графике: линии, столбцы, комбинации или точки |
| Lines width (when lines are included in display) (LinesWidth) | LinesWidth — Ширина линий при отображении линий в визуализации |
| Bars width (when bars are included in display) (BarsWidth) | BarsWidth — Ширина столбцов при отображении столбцов в визуализации |
| Turn alerts on? (alertsOn) | alertsOn — Включение или отключение системы уведомлений |
| Alerts on current (still opened) bar? (alertsOnCurrent) | alertsOnCurrent — Оценка уведомлений на текущем (открытом) баре |
| Alerts should display alert message? (alertsMessage) | alertsMessage — Отображение текстового сообщения уведомления |
| Alerts should play alert sound? (alertsSound) | alertsSound — Воспроизведение звукового сигнала при уведомлении |
| Alerts should send alert notification? (alertsPushNotif) | alertsPushNotif — Отправка push-уведомлений |
| Alerts should send alert email? (alertsEmail) | alertsEmail — Отправка уведомлений по электронной почте |
| "stops.wav" //"alert2.wav" //"expert.wav"; (soundFile) | soundFile — Путь к звуковому файлу для воспроизведения при уведомлении |
| Upper band in pips (<= 0 - no band) (UpPips) | UpPips — Величина верхней полосы в пунктах (значение ≤ 0 — полоса не отображается) |
| Lower band in pips (<= 0 - no band) (DnPips) | DnPips — Величина нижней полосы в пунктах (значение ≤ 0 — полоса не отображается) |
| 159; // Up Arrow code (ArrowCodeUp) | ArrowCodeUp — Код стрелки для отрисовки маркера восходящего направления на графике |
| 159; // Down Arrow code (ArrowCodeDn) | ArrowCodeDn — Код стрелки для отрисовки маркера нисходящего направления на графике |
| Gap for arrow up (ArrowGapUp) | ArrowGapUp — Отступ для размещения стрелки вверх от расчётной точки |
| Gap for arrow down (ArrowGapDn) | ArrowGapDn — Отступ для размещения стрелки вниз от расчётной точки |
| Up Arrow Size (ArrowSizeUp) | ArrowSizeUp — Размер стрелки для маркера восходящего направления |
| Down Arrow Size (ArrowSizeDn) | ArrowSizeDn — Размер стрелки для маркера нисходящего направления |
| Arrow on first bars (ArrowOnFirst) | ArrowOnFirst — Отображение стрелок на первых барах графика |
| Average shift (Shift) | Shift — Сдвиг усреднённого значения |
| Interpolating method when using multi time frame mode (Interpolate) | Interpolate — Метод интерполяции при использовании многопериодного режима |
Поиск по коду файла
#property indicator_chart_window
#property indicator_buffers 9
#property indicator_color1 clrLimeGreen
#property indicator_color2 clrOrange
#property indicator_color3 clrRoyalBlue //clrLimeGreen
#property indicator_color4 clrCrimson //clrOrange
#property indicator_color5 clrOrange
#property indicator_color6 clrSilver
#property indicator_color7 clrSilver
#property indicator_color8 clrWhite //clrLimeGreen
#property indicator_color9 clrRed //clrOrange
#property indicator_style6 STYLE_DOT
#property indicator_style7 STYLE_DOT
enum enTimeFrames
{
tf_cu = 0, // Current time frame
tf_m1 = PERIOD_M1, // 1 minute
tf_m5 = PERIOD_M5, // 5 minutes
tf_m15 = PERIOD_M15, // 15 minutes
tf_m30 = PERIOD_M30, // 30 minutes
tf_h1 = PERIOD_H1, // 1 hour
tf_h4 = PERIOD_H4, // 4 hours
tf_d1 = PERIOD_D1, // Daily
tf_w1 = PERIOD_W1, // Weekly
tf_mb1 = PERIOD_MN1, // Monthly
tf_cus = 12345678 // Custom time frame
};
enum enIterpolation
{
int_noint, // No interpolation
int_line, // Linear interpolation
int_quad // Quadratic interpolation
};
enum enDisplay
{
en_lin, // Display lines
en_his, // Display colored bars
en_all, // Display colored lines and bars
en_lid, // Display lines with dots
en_hid, // Display colored bars with dots
en_ald, // Display colored lines and bars with dots
en_dot // Display dots
};
enum calc { MACD, OsMA };
extern enTimeFrames TimeFrame = tf_cu; // Time frame
extern int TimeFrameCustom = 0; // Custom time frame to use (if custom time frame used)
input calc РАСЧЁТ = OsMA;
input int Fast = 12; //Быстрая - Период
input int Slow = 26; //Медленная - Период
input int Signal = 9; //Сигнальная - Период
input ENUM_MA_METHOD Mode = MODE_EMA; //Быстрая и Медленная - Метод
input ENUM_APPLIED_PRICE Price = PRICE_CLOSE; //Быстрая и Медленная - Цена
extern enDisplay DisplayType = en_ald; //en_lin; // Display type
extern int LinesWidth = 2; // Lines width (when lines are included in display)
extern int BarsWidth = 2; // Bars width (when bars are included in display)
extern bool alertsOn = true; // Turn alerts on?
extern bool alertsOnCurrent = false; // Alerts on current (still opened) bar?
extern bool alertsMessage = true; // Alerts should display alert message?
extern bool alertsSound = true; // Alerts should play alert sound?
extern bool alertsPushNotif = false; // Alerts should send alert notification?
extern bool alertsEmail = false; // Alerts should send alert email?
extern string soundFile = "news.wav"; //"stops.wav" //"alert2.wav" //"expert.wav";
extern double UpPips = 0; // Upper band in pips (<= 0 - no band)
extern double DnPips = 0; // Lower band in pips (<= 0 - no band)
extern int ArrowCodeUp = 233; //159; // Up Arrow code
extern int ArrowCodeDn = 234; //159; // Down Arrow code
extern double ArrowGapUp = 0.5; // Gap for arrow up
extern double ArrowGapDn = 0.5; // Gap for arrow down
extern int ArrowSizeUp = 1; // Up Arrow Size
extern int ArrowSizeDn = 1; // Down Arrow Size
extern bool ArrowOnFirst = true; // Arrow on first bars
extern int Shift = 0; // Average shift
extern enIterpolation Interpolate = int_line; // Interpolating method when using multi time frame mode
double histou[];
double histod[];
double LineBuffer[];
double DnBuffera[];
double DnBufferb[];
double bandUp[];
double bandDn[];
double arrowu[];
double arrowd[];
double smin[];
double smax[];
double trend[];
double PREV[], SIGMA[], CLON[];
string indicatorFileName;
bool returnBars;
int init()
{
// код доступен только после оплаты
}
int deinit() { return(0); }
int start()
{
// код доступен только после оплаты
}
int i, CountedBars=IndicatorCounted();
if (CountedBars<0) return(-1);
if (CountedBars>0) CountedBars--;
int limit = fmin(Bars-CountedBars,Bars-1);
if (returnBars) { histou[0] = fmin(limit+1,Bars-1); return(0); }
if (TimeFrame == _Period)
{
if (trend[limit]==-1) CleanPoint(limit,DnBuffera,DnBufferb);
for(i=limit; i>=0; i--)
{
PREV[i] = Close[i] - (iMA(NULL,0,Fast,0,Mode,Price,i) - iMA(NULL,0,Slow,0,Mode,Price,i));
if (РАСЧЁТ==MACD) LineBuffer[i] = PREV[i]; ///Close[i] - (iMA(NULL,0,Fast,0,Mode,Price,i) - iMA(NULL,0,Slow,0,Mode,Price,i)); //iStepMa(Sensitivity,iATR(NULL,0,StepSize,i),1.0,thigh,tlow,Close[i],i);
}
for(i=limit; i>=0; i--)
{
if (РАСЧЁТ==OsMA) {
SIGMA[i] = iMAOnArray(PREV,0,Signal,0,Mode,i);
LineBuffer[i] = Close[i] - (PREV[i] - SIGMA[i]);
CLON[i] = iOsMA(NULL,0,Fast,Slow,Signal,Price,i); }
DnBuffera[i] = EMPTY_VALUE;
DnBufferb[i] = EMPTY_VALUE;
histou[i] = EMPTY_VALUE;
histod[i] = EMPTY_VALUE;
arrowu[i] = EMPTY_VALUE;
arrowd[i] = EMPTY_VALUE;
trend[i] = trend[i+1];
if (LineBuffer[i] < Close[i]) trend[i] = 1;
if (LineBuffer[i] > Close[i]) trend[i] =-1;
if (РАСЧЁТ==OsMA) {
trend[i] = trend[i+1];
if (CLON[i] > 0) trend[i] = 1;
if (CLON[i] < 0) trend[i] =-1; }
if (i<(Bars-1))
{
if (trend[i]==-1) PlotPoint(i,DnBuffera,DnBufferb,LineBuffer);
if (trend[i]==-1) { histou[i] = Low[i]; histod[i] = High[i]; }
if (trend[i]== 1) { histod[i] = Low[i]; histou[i] = High[i]; }
}
if (UpPips>0) bandUp[i] = LineBuffer[i]+UpPips*_Point*MathPow(10,_Digits%2);
if (DnPips>0) bandDn[i] = LineBuffer[i]-DnPips*_Point*MathPow(10,_Digits%2);
if (i<Bars-1 && trend[i]!= trend[i+1])
{
if (trend[i] == 1) arrowu[i] = fmin(LineBuffer[i],Low[i] )-iATR(NULL,0,15,i)*ArrowGapUp;
if (trend[i] == -1) arrowd[i] = fmax(LineBuffer[i],High[i])+iATR(NULL,0,15,i)*ArrowGapDn;
}
}
if (alertsOn)
{
int whichBar = 1; if (alertsOnCurrent) whichBar = 0;
if (trend[whichBar] != trend[whichBar+1])
if (trend[whichBar] == 1)
doAlert("больше ZERO = BUY"); ///doAlert("up");
else doAlert("меньше ZERO = SELL"); ///doAlert("down");
}
return(0);
}
limit = (int)fmax(limit,fmin(Bars-1,iCustom(NULL,TimeFrame,indicatorFileName,-99,0,0)*TimeFrame/_Period));
if (trend[limit]==-1) CleanPoint(limit,DnBuffera,DnBufferb);
for (i=limit; i>=0; i--)
{
int y = iBarShift(NULL,TimeFrame,Time[i]);
int x = y;
if (ArrowOnFirst)
{ if (i<Bars-1) x = iBarShift(NULL,TimeFrame,Time[i+1]); }
else { if (i>0) x = iBarShift(NULL,TimeFrame,Time[i-1]); else x = -1; }
trend[i] = iCustom(NULL,TimeFrame,indicatorFileName,tf_cu,0, РАСЧЁТ,Fast,Slow,Signal,Mode,Price, Показано первые 50% кода (символов: 14850)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.