Slow stochastic with alert
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «slow stochastic with alert.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Slow stochastic with alert — это пользовательский индикатор для MetaTrader 4, который строит медленный стохастик на графике и отображает стрелочные сигналы при наступлении заданных условий. Индикатор использует стандартную функцию iStochastic с настраиваемыми периодами K, SD и D, а также уровями перекупленности и перепроданности.
Индикатор способен генерировать уведомления несколькими способами: всплывающие окна, push-уведомления, электронная почта, звуковые сигналы, запуск внешних программ и расширенные оповещения через DLL-библиотеку. Каждый тип оповещения включается отдельным переключателем в настройках.
Сигналы отрисовываются в виде стрелок на графике для пересечений линий K и D, а также для переходов через уровни перекупленности и перепроданности. Каждый тип сигнала имеет собственное имя и цвет, что позволяет визуально различать события на графике.
Настройки программы
| Настройка | Описание |
|---|---|
| K Period (K) | K — Период K стохастика |
| SD Period (SD) | SD — Период SD стохастика |
| D period (D) | D — Период D стохастика |
| OB Level (overbought) | overbought — Уровень перекупленности |
| OS Level (oversold) | oversold — Уровень перепроданности |
| Show K/D Alert (k_d_alert) | k_d_alert — Отображение сигнала при пересечении линий K и D |
| Show K/overbought Alert (k_ob_alert) | k_ob_alert — Отображение сигнала при пересечении K уровня перекупленности |
| Show K/oversold Alert (k_os_alert) | k_os_alert — Отображение сигнала при пересечении K уровня перепроданности |
| Show D/overbought Alert (d_ob_alert) | d_ob_alert — Отображение сигнала при пересечении D уровня перекупленности |
| Show D/oversold Alert (d_os_alert) | d_os_alert — Отображение сигнала при пересечении D уровня перепроданности |
| == Alerts == (AlertsSection) | AlertsSection — Текстовый параметр для раздела оповещений |
| Popup message (popup_alert) | popup_alert — Отображение всплывающего окна при оповещении |
| Push notification (notification_alert) | notification_alert — Отправка push-уведомлений |
| Email (email_alert) | email_alert — Отправка уведомлений по электронной почте |
| Play sound on alert (play_sound) | play_sound — Воспроизведение звука при срабатывании оповещения |
| Sound file (sound_file) | sound_file — Путь к звуковому файлу для оповещений |
| Start external program (start_program) | start_program — Запуск внешней программы при оповещении |
| Advanced alert (Telegram/Discord/other platform (like another MT4)) (advanced_alert) | advanced_alert — Включение расширенных оповещений через DLL (Telegram/Discord и др.) |
| Comment2 | Comment2 — Текстовый параметр с информационным комментарием |
| Comment3 | Comment3 — Текстовый параметр с информационным комментарием |
| Comment4 | Comment4 — Текстовый параметр с информационным комментарием |
Поиск по коду файла
#property version "1.0"
#property strict
#property indicator_buffers 10
#property indicator_chart_window
class InstrumentInfo
{
string _symbol;
double _mult;
double _point;
double _pipSize;
int _digits;
double _tickSize;
public:
InstrumentInfo(const string symbol)
{
_symbol = symbol;
_point = MarketInfo(symbol, MODE_POINT);
_digits = (int)MarketInfo(symbol, MODE_DIGITS);
_mult = _digits == 3 || _digits == 5 ? 10 : 1;
_pipSize = _point * _mult;
_tickSize = MarketInfo(_symbol, MODE_TICKSIZE);
}
static double GetBid(const string symbol) { return MarketInfo(symbol, MODE_BID); }
double GetBid() { return GetBid(_symbol); }
static double GetAsk(const string symbol) { return MarketInfo(symbol, MODE_ASK); }
double GetAsk() { return GetAsk(_symbol); }
static double GetPipSize(const string symbol)
{
double point = MarketInfo(symbol, MODE_POINT);
double digits = (int)MarketInfo(symbol, MODE_DIGITS);
double mult = digits == 3 || digits == 5 ? 10 : 1;
return point * mult;
}
double GetPipSize() { return _pipSize; }
double GetPointSize() { return _point; }
string GetSymbol() { return _symbol; }
double GetSpread() { return (GetAsk() - GetBid()) / GetPipSize(); }
int GetDigits() { return _digits; }
double GetTickSize() { return _tickSize; }
double GetMinLots() { return SymbolInfoDouble(_symbol, SYMBOL_VOLUME_MIN); };
double RoundRate(const double rate)
{
return NormalizeDouble(MathFloor(rate / _tickSize + 0.5) * _tickSize, _digits);
}
};
interface IStream
{
public:
virtual void AddRef() = 0;
virtual void Release() = 0;
virtual bool GetValue(const int period, double &val) = 0;
};
class AStream : public IStream
{
protected:
string _symbol;
ENUM_TIMEFRAMES _timeframe;
double _shift;
InstrumentInfo *_instrument;
int _references;
AStream(const string symbol, const ENUM_TIMEFRAMES timeframe)
{
_references = 1;
_shift = 0.0;
_symbol = symbol;
_timeframe = timeframe;
_instrument = new InstrumentInfo(_symbol);
}
~AStream()
{
delete _instrument;
}
public:
void SetShift(const double shift)
{
_shift = shift;
}
void AddRef()
{
++_references;
}
void Release()
{
--_references;
if (_references == 0)
delete &this;
}
};
enum PriceType
{
PriceClose = PRICE_CLOSE, // Close
PriceOpen = PRICE_OPEN, // Open
PriceHigh = PRICE_HIGH, // High
PriceLow = PRICE_LOW, // Low
PriceMedian = PRICE_MEDIAN, // Median
PriceTypical = PRICE_TYPICAL, // Typical
PriceWeighted = PRICE_WEIGHTED, // Weighted
PriceMedianBody, // Median (body)
PriceAverage, // Average
PriceTrendBiased, // Trend biased
PriceVolume, // Volume
};
class PriceStream : public AStream
{
PriceType _price;
public:
PriceStream(const string symbol, const ENUM_TIMEFRAMES timeframe, const PriceType price)
:AStream(symbol, timeframe)
{
_price = price;
}
bool GetValue(const int period, double &val)
{
switch (_price)
{
case PriceClose:
val = iClose(_symbol, _timeframe, period);
break;
case PriceOpen:
val = iOpen(_symbol, _timeframe, period);
break;
case PriceHigh:
val = iHigh(_symbol, _timeframe, period);
break;
case PriceLow:
val = iLow(_symbol, _timeframe, period);
break;
case PriceMedian:
val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period)) / 2.0;
break;
case PriceTypical:
val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period)) / 3.0;
break;
case PriceWeighted:
val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period) * 2) / 4.0;
break;
case PriceMedianBody:
val = (iOpen(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period)) / 2.0;
break;
case PriceAverage:
val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period) + iOpen(_symbol, _timeframe, period)) / 4.0;
break;
case PriceTrendBiased:
{
double close = iClose(_symbol, _timeframe, period);
if (iOpen(_symbol, _timeframe, period) > iClose(_symbol, _timeframe, period))
val = (iHigh(_symbol, _timeframe, period) + close) / 2.0;
else
val = (iLow(_symbol, _timeframe, period) + close) / 2.0;
}
break;
case PriceVolume:
val = (double)iVolume(_symbol, _timeframe, period);
break;
}
val += _shift * _instrument.GetPipSize();
return true;
}
};
interface ICondition
{
public:
virtual bool IsPass(const int period) = 0;
};
#import "AdvancedNotificationsLib.dll"
void AdvancedAlert(string key, string text, string instrument, string timeframe);
#import
#import "shell32.dll"
int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#import
class Signaler
{
string _symbol;
ENUM_TIMEFRAMES _timeframe;
datetime _lastDatetime;
public:
Signaler(const string symbol, ENUM_TIMEFRAMES timeframe)
{
_symbol = symbol;
_timeframe = timeframe;
}
string GetSymbol()
{
return _symbol;
}
ENUM_TIMEFRAMES GetTimeframe()
{
return _timeframe;
}
string GetTimeframeStr()
{
switch (_timeframe)
{
case PERIOD_M1: return "M1";
case PERIOD_M5: return "M5";
case PERIOD_D1: return "D1";
case PERIOD_H1: return "H1";
case PERIOD_H4: return "H4";
case PERIOD_M15: return "M15";
case PERIOD_M30: return "M30";
case PERIOD_MN1: return "MN1";
case PERIOD_W1: return "W1";
}
return "M1";
}
void SendNotifications(const string subject, string message = NULL, string symbol = NULL, string timeframe = NULL)
{
if (message == NULL)
message = subject;
if (symbol == NULL)
symbol = _symbol;
if (timeframe == NULL)
timeframe = GetTimeframeStr();
if (start_program)
ShellExecuteW(0, "open", program_path, "", "", 1);
if (popup_alert)
Alert(message);
if (email_alert)
SendMail(subject, message);
if (play_sound)
PlaySound(sound_file);
if (notification_alert)
SendNotification(message);
if (advanced_alert && advanced_key != "" && !IsTesting())
AdvancedAlert(advanced_key, message, symbol, timeframe);
}
};
class AlertSignal
{
double _signals[];
ICondition* _condition;
IStream* _price;
Signaler* _signaler;
string _message;
datetime _lastSignal;
public:
AlertSignal(ICondition* condition, IStream* price, Signaler* signaler)
{
_condition = condition;
_price = price;
_price.AddRef();
_signaler = signaler;
}
~AlertSignal()
{
_price.Release();
delete _condition;
}
int RegisterStreams(int id, string name, int code, color clr)
{
SetIndexStyle(id + 0, DRAW_ARROW, 0, 2, clr);
SetIndexBuffer(id + 0, _signals);
SetIndexLabel(id + 0, name);
SetIndexArrow(id + 0, code);
_message = name;
return id + 1;
}
void Update(int period)
{
if (_condition.IsPass(period))
{
double price;
if (_price.GetValue(period, price))
{
_signals[period] = price;
string symbol = _signaler.GetSymbol();
if (period == 0 && _lastSignal != iTime(symbol, _signaler.GetTimeframe(), 0))
{
_signaler.SendNotifications(symbol + "/" + _signaler.GetTimeframeStr() + ": " + _message);
_lastSignal = iTime(symbol, _signaler.GetTimeframe(), 0);
}
return;
}
}
_signals[period] = EMPTY_VALUE;
}
};
string IndicatorName;
string IndicatorObjPrefix;
string GenerateIndicatorName(const string target)
{
string name = target;
int try = 2;
while (WindowFind(name) != -1)
{
name = target + " #" + IntegerToString(try++);
}
return name;
}
input int K = 5; // K Period
input int SD = 3; // SD Period
input int D = 3; // D period
input int overbought = 80; // OB Level
input int oversold = 20; // OS Level
input bool k_d_alert = true; // Show K/D Alert
input bool k_ob_alert = false; // Show K/overboughПоказано первые 50% кода (символов: 13217)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.