ea studio xauusd @lifeindreamsworld.mq4
Похожие материалы по тегам
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «ea studio xauusd @lifeindreamsworld.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Данный продукт представляет собой торговый советник для платформы MetaTrader 4, предназначенный для работы с инструментом XAUUSD. Советник обрабатывает рыночные и торговые события, автоматически открывая и закрывая позиции в соответствии с встроенными фильтрами сигналов.
Для формирования сигналов на вход в позицию используется фильтр анализа свечных характеристик, а для контроля выхода — фильтр на основе индикатора Accelerator Oscillator. Оба фильтра имеют настраиваемые параметры, позволяющие адаптировать логику под предпочтения трейдера.
Советник поддерживает торговлю в заданные сессионные окна с настраиваемым временем для разных дней недели, а также управление защитным стоп-лоссом (trailing stop) для активных позиций. При исполнении ордеров реализована система повторных попыток с автоматическим определением типа защиты позиции.
Настройки программы
| Настройка | Описание |
|---|---|
| Stop Loss (pips) (Stop_Loss) | Уровень стоп-лосса для позиций, задаваемый в пунктах. |
| Take Profit (pips) (Take_Profit) | Уровень тейк-профита для позиций, задаваемый в пунктах. |
| Min body height [pips] (Ind0Param0) | Минимальная высота тела свечи для фильтра анализа свечных характеристик, задаваемая в пунктах. |
| Consecutive candles (Ind0Param1) | Количество последовательных свечей, необходимых для формирования сигнала на вход в позицию. |
| Level (Ind1Param0) | Уровень индикатора Accelerator Oscillator, при достижении которого срабатывает фильтр выхода из позиции. |
Поиск по коду файла
#property version "3.3"
#property strict
static input string _Properties_ = "------"; // --- Expert Properties ---
static input double Entry_Amount = 1.00; // Entry lots
input int Stop_Loss = 2800; // Stop Loss (pips)
input int Take_Profit = 0; // Take Profit (pips)
static input string ___0______ = "------"; // --- Candle Color ---
input int Ind0Param0 = 45; // Min body height [pips]
input int Ind0Param1 = 3; // Consecutive candles
static input string ___1______ = "------"; // --- Accelerator Oscillator ---
input double Ind1Param0 = -10.0000; // Level
static input string _Settings___ = "------"; // --- Expert Settings ---
static input int Magic_Number = 70623123; // Magic Number
#define TRADE_RETRY_COUNT 4
#define TRADE_RETRY_WAIT 100
#define OP_FLAT -1
int sessionSundayOpen = 0; // 00:00
int sessionSundayClose = 86400; // 24:00
int sessionMondayThursdayOpen = 36000; // 10:00
int sessionMondayThursdayClose = 50400; // 14:00
int sessionFridayOpen = 36000; // 10:00
int sessionFridayClose = 50400; // 14:00
bool sessionIgnoreSunday = false;
bool sessionCloseAtSessionClose = false;
bool sessionCloseAtFridayClose = false;
const double sigma = 0.000001;
const int requiredBars = 36;
double posType = OP_FLAT;
int posTicket = 0;
double posLots = 0;
double posStopLoss = 0;
double posTakeProfit = 0;
datetime barTime;
double pip;
double stopLevel;
bool isTrailingStop = false;
bool setProtectionSeparately = false;
int OnInit()
{
// код доступен только после оплаты
}
void OnTick()
{
// код доступен только после оплаты
}
void OnBar()
{
UpdatePosition();
if (posType != OP_FLAT && IsForceSessionClose())
{
ClosePosition();
return;
}
if ( IsOutOfSession() )
return;
if (posType != OP_FLAT)
{
ManageClose();
UpdatePosition();
}
if (posType != OP_FLAT && isTrailingStop)
{
double trailingStop = GetTrailingStopPrice();
ManageTrailingStop(trailingStop);
UpdatePosition();
}
int entrySignal = GetEntrySignal();
if ((posType == OP_BUY && entrySignal == OP_SELL) ||
(posType == OP_SELL && entrySignal == OP_BUY ))
{
ClosePosition();
UpdatePosition();
}
if (posType == OP_FLAT && entrySignal != OP_FLAT)
{
OpenPosition(entrySignal);
UpdatePosition();
}
}
void UpdatePosition()
{
posType = OP_FLAT;
posTicket = 0;
posLots = 0;
int total = OrdersTotal();
for (int pos = total - 1; pos >= 0; pos--)
{
if (OrderSelect(pos, SELECT_BY_POS) &&
OrderSymbol() == _Symbol &&
OrderMagicNumber() == Magic_Number)
{
posType = OrderType();
posLots = OrderLots();
posTicket = OrderTicket();
posStopLoss = OrderStopLoss();
posTakeProfit = OrderTakeProfit();
break;
}
}
}
int GetEntrySignal()
{
bool ind0long = false;
bool ind0short = false;
{
int consecutiveBullish = 0;
int consecutiveBearish = 0;
double pipVal = pip * Ind0Param0;
for (int b = Ind0Param1 + 2; b > 0; b--)
{
consecutiveBullish = Close(b) - Open(b) >= pipVal ? consecutiveBullish + 1 : 0;
consecutiveBearish = Open(b) - Close(b) >= pipVal ? consecutiveBearish + 1 : 0;
}
ind0long = consecutiveBearish >= Ind0Param1;
ind0short = consecutiveBullish >= Ind0Param1;
}
bool canOpenLong = ind0long;
bool canOpenShort = ind0short;
return canOpenLong && !canOpenShort ? OP_BUY
: canOpenShort && !canOpenLong ? OP_SELL
: OP_FLAT;
}
void ManageClose()
{
double ind1val1 = iAC(NULL, 0, 1);
bool ind1long = ind1val1 < Ind1Param0 - sigma;
bool ind1short = ind1val1 > -Ind1Param0 + sigma;
if ( (posType == OP_BUY && ind1long) ||
(posType == OP_SELL && ind1short) )
ClosePosition();
}
void OpenPosition(int command)
{
for (int attempt = 0; attempt < TRADE_RETRY_COUNT; attempt++)
{
int ticket = 0;
int lastError = 0;
bool modified = false;
string comment = IntegerToString(Magic_Number);
color arrowColor = command == OP_BUY ? clrGreen : clrRed;
if (IsTradeContextFree())
{
double price = command == OP_BUY ? Ask() : Bid();
double stopLoss = GetStopLossPrice(command);
double takeProfit = GetTakeProfitPrice(command);
if (setProtectionSeparately)
{
ticket = OrderSend(_Symbol, command, Entry_Amount, price, 10, 0, 0, comment, Magic_Number, 0, arrowColor);
if (ticket > 0 && (Stop_Loss > 0 || Take_Profit > 0))
modified = OrderModify(ticket, 0, stopLoss, takeProfit, 0, clrBlue);
}
else
{
ticket = OrderSend(_Symbol, command, Entry_Amount, price, 10, stopLoss, takeProfit, comment, Magic_Number, 0, arrowColor);
lastError = GetLastError();
if (ticket <= 0 && lastError == 130)
{
ticket = OrderSend(_Symbol, command, Entry_Amount, price, 10, 0, 0, comment, Magic_Number, 0, arrowColor);
if (ticket > 0 && (Stop_Loss > 0 || Take_Profit > 0))
modified = OrderModify(ticket, 0, stopLoss, takeProfit, 0, clrBlue);
if (ticket > 0 && modified)
{
setProtectionSeparately = true;
Print("Detected ECN type position protection.");
}
}
}
}
if Показано первые 50% кода (символов: 8471)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.