← К каталогу
Исходный код · ID 2413

ParadiseWay

paradisewaymt4.mq4
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

ParadiseWay — торговый советник для MetaTrader 4, предназначенный для работы с межзависимыми инструментами австралийского, канадского и новозеландского долларов. Советник использует канальный индикатор на основе полос Боллинджера для генерации торговых сигналов на заданном таймфрейме.

При закрытии свечи ниже нижней полосы советник открывает позицию BUY, при закрытии выше верхней полосы — позицию SELL. Поддерживается добавление ордеров по сетке с множителем лота. Доступны настройки фиксированного лота или расчёта по проценту риска от свободного маржа.

Включены фильтр максимального спреда, защита по максимальной просадке (блокировка новых ордеров), автоматическое закрытие всех позиций при достижении целевой прибыли в процентах от баланса, а также отображение информационного текста на графике.

Настройки программы

НастройкаОписание
_tools Торговые инструменты — Группа торговых инструментов
Work Pairs (workPairs) Рабочие пары — Список рабочих валютных пар через запятую
Enable one series in this period (oneEpisode) Одна серия за период — Включение одной серии ордеров за период
One series of orders in this period (only1timeTF) Таймфрейм серии — Таймфрейм для серии ордеров
_lot Настройки лота — Группа настроек лота
MaxRisk (MaxRisk) Максимальный риск — Максимальный процент риска от свободного маржа для расчёта лота (при > 0)
if MaxRisk = 0, Lot will be (Lots) Лот — Фиксированный размер лота (используется при MaxRisk = 0)
Max lot (MaxLot) Максимальный лот — Максимально допустимый размер лота
_tp Настройки TP и SL — Группа настроек тейк-профита и стоп-лосса
Take profit (take_profit) Тейк-профит — Тейк-профит в пунктах (0 — без тейк-профита)
Stop loss (stop_loss) Стоп-лосс — Стоп-лосс в пунктах (0 — без стоп-лосса)
Take profit as a percentage (profitPercent) Процент прибыли — Процент прибыли от баланса для автоматического закрытия всех позиций
Drawdown % to block new orders (if > 0) (maxDD) Максимальная просадка — Процент просадки для блокировки новых ордеров (если > 0)
_trans Дополнительные транзакции — Группа дополнительных транзакций
Step between orders (between) Шаг между ордерами — Шаг между ордерами в пунктах для сетки
Multiplication (mult) Множитель лота — Множитель лота для сеточных ордеров
Max trades (maxTrades) Максимальное число сделок — Максимальное количество ордеров по направлению
Max spread (maxSpread) Максимальный спред — Максимально допустимый спред в пунктах
_canal Настройки канала — Группа настроек канала
Signal TF (signalTF) Таймфрейм сигнала — Таймфрейм для сигнального канала
Canal period (canal_period) Период канала — Период канала (полосы Боллинджера)
Canal deviation (canal_deviation) Отклонение канала — Отклонение полос Боллинджера
Applied price (canal_price) Цена канала — Применяемая цена для канала
_not Прочие параметры — Группа параметров, не влияющих на торговлю
Comments to orders (_comment) Комментарий — Комментарий к открытым ордерам
Magic Магический номер — Магический номер для идентификации ордеров советника
Slipage (Slipage) Слипейдж — Допустимое отклонение цены при исполнении ордера
Show info text (showInfoText) Показать информационный текст — Отображение информационного текста на графике
Text size (textSize) Размер текста — Размер шрифта текста на графике
Text color (textColor) Цвет текста — Цвет текста на графике
Corporate color of the chart (chartColor) Цвет графика — Включение корпоративной цветовой схемы графика
Получить полный код

Поиск по коду файла

#property version   "3.0"
#property strict

#property description "An expert for working with interdependent trading instruments between the Australian dollar, the Canadian dollar and the New Zealand dollar"

input string _tools = "------ Trader's trading tools";

input string workPairs = "AUDNZD, NZDCAD, AUDCAD";//Work Pairs
input bool oneEpisode = true;//Enable one series in this period
input ENUM_TIMEFRAMES only1timeTF = PERIOD_M1;//One series of orders in this period

input string _lot = "------ Lot settings";
input double MaxRisk=2.0;//MaxRisk
input double Lots=0.01;//if MaxRisk = 0, Lot will be
input double MaxLot = 1000.0;//Max lot

input string _tp = "------ TP & SL";
input int take_profit = 350;//Take profit
input int stop_loss = 0;//Stop loss
input double profitPercent = 6.0;//Take profit as a percentage
input double maxDD = 0;//Drawdown % to block new orders (if > 0)

input string _trans = "------ Ancillary transactions";
input int between = 450;//Step between orders
input double mult = 1.5;//Multiplication
input int maxTrades = 300;//Max trades
input int maxSpread = 85;//Max spread

int SL = 500;

input string _canal = "------ Canal settings";
input ENUM_TIMEFRAMES signalTF = PERIOD_D1;//Signal TF
input  int                 canal_period = 3;//Canal period
int                 canal_shift = 0;//Смещение индикатора по горизонтали
input double              canal_deviation = 0.5;//Canal deviation
input ENUM_APPLIED_PRICE  canal_price = PRICE_MEDIAN;//Applied price
int  candleCanal = 3;

input string _not = "------ Does not affect trade";
input string _comment = "ParadiseWay";//Comments to orders
input int Magic = 98555220;
input int Slipage = 5;//Slipage
bool logo = false;//Show logo
input bool showInfoText = true;//Show info text
input int textSize = 10;//Text size
input color textColor = clrWhite;//Text color
input bool chartColor = true;//Corporate color of the chart

string logoObjectName="objLogo";
string          InpFile="::Images\\logoF.bmp"; // Имя файла с картинкой

string arrayPair[];

string znak=",";
ushort u_sep = -1;
string firstPairs = "";
double balance = 0;
datetime timez[];
int kz = 0;
double upLine[1];
double dwLine[1];
double middleLine[1];

int OnInit()
  {
      // код доступен только после оплаты
   }

void OnDeinit(const int reason)
  {

   kz = 0;
   Comment("");
   ObjectDelete(0,logoObjectName);
   ObjectsDeleteAll(0,"infoLabel");

   znak=",";
   u_sep = -1;
   firstPairs = "";
   balance = 0;
   kz = 0;
   Comment("");
  }

void OnTick()
  {
      // код доступен только после оплаты
   }
   string pairs="";
   double size = 0;

   /*  if(TimeCurrent() > D'2023.04.29 00:00')
       {
        Comment("You need to update the EA version");
        return;
       }
   /*
    if(AccountInfoInteger(ACCOUNT_LOGIN) != 2109031021 && !IsTesting())
      {
       Comment("ONLY FOR 2109031021");
       return;
      }
   */

   for(int d=0; d<kz; d++)
     {
      firstPairs = arrayPair[0];
      string thisPair = arrayPair[d];
      StringReplace(thisPair," ","");

      if(iTime(thisPair,only1timeTF,1) != timez[d])
         timez[d] = iTime(thisPair,only1timeTF,1);
      else
         continue;

      if(SymbolInfoDouble(thisPair, SYMBOL_BID) <= 0 || /*iVolume(thisPair,PERIOD_CURRENT,0) > 1*/ thisPair == "") // проверка на существование символа и работа на открытии свечи
         continue;

      double equity = AccountInfoDouble(ACCOUNT_EQUITY);

      if(profitPercent > 0 && equity >= balance + (balance / 100 * profitPercent))
        {
         CloseAllPosition(Magic);
         balance = AccountInfoDouble(ACCOUNT_BALANCE);
        }

      if(oneEpisode && iBarShift(firstPairs,only1timeTF,getLastBarLastClosePos(Magic)) == 0 && CalculatePositions(-1, firstPairs, Magic) == 0)
         return;

      upLine[0] = iBands(thisPair,signalTF,canal_period,canal_deviation,canal_shift,canal_price,MODE_UPPER,1);
      dwLine[0] = iBands(thisPair,signalTF,canal_period,canal_deviation,canal_shift,canal_price,MODE_LOWER,1);
      middleLine[0] = iBands(thisPair,signalTF,canal_period,canal_deviation,canal_shift,canal_price,MODE_MAIN,1);

      ArraySetAsSeries(upLine,true);
      ArraySetAsSeries(dwLine,true);
      ArraySetAsSeries(middleLine,true);

      int countBuys = CalculatePositions(OP_BUY, "", Magic);
      int countSells = CalculatePositions(OP_SELL, "", Magic);//&& iOpen(thisPair,signalTF,1) > iClose(thisPair,signalTF,1)  && (countBuy + countSell)  % 2 == 0
      int countBuy = CalculatePositions(OP_BUY,thisPair, Magic);
      int countSell = CalculatePositions(OP_SELL, thisPair, Magic);

      if(countBuy > 0 && iClose(thisPair,PERIOD_M1,1) > middleLine[0]  + SymbolInfoInteger(thisPair,SYMBOL_SPREAD) * SymbolInfoDouble(thisPair,SYMBOL_POINT))
         CloseAllPosition(Magic,OP_BUY,thisPair);
      if(countSell > 0 && iClose(thisPair,PERIOD_M1,1) < middleLine[0]  - SymbolInfoInteger(thisPair,SYMBOL_SPREAD) * SymbolInfoDouble(thisPair,SYMBOL_POINT))
         CloseAllPosition(Magic,OP_SELL,thisPair);

      if(showInfoText)
        {
         string totalProfit =  DoubleToString(profitPositions(Magic),2);

         textLabel(7777, "EA ParadiseWay: current profit: " + totalProfit, 50, 20, 0, textColor, "Arial", textSize+3);
         string info = ": " + DoubleToString(SymbolInfoDouble(thisPair,SYMBOL_BID), SymbolInfoInteger(thisPair,SYMBOL_DIGITS)) + " | Spread: " + SymbolInfoInteger(thisPair,SYMBOL_SPREAD) + " | Profit: " + DoubleToString(profitPositions(thisPair, Magic),2);
         textLabel(d, thisPair + info, 55, 50+ (20*d), 0, textColor, "Arial", textSize);
        }

      if(maxDD > 0)
        {
         double bala = AccountInfoDouble(ACCOUNT_BALANCE);
         double eqva = AccountInfoDouble(ACCOUNT_EQUITY);
         double dd = 100*(eqva - bala)/bala;

         if(0-maxDD > dd)
           {
            string ddd = "The drawdown is exceeded. Orders will not be opened";

            textLabel(2000, ddd, 55, 50+ (20*(d+1)), 0, clrRed, "Arial", textSize);
            break;
           }
         else
           {
            ObjectDelete(0,"infoLabel2000");
           }
        }

      double lota=Lots;
      if(MaxRisk > 0)
         lota = LotByRisk(thisPair);
      if(lota>MaxLot)
         lota = MaxLot;

      if(!CheckVolumeValue(lota, thisPair) || !CheckMoneyForTrade(thisPair, lota, ORDER_TYPE_BUY) || !CheckMoneyForTrade(thisPair, lota, ORDER_TYPE_SELL))
         continue;

      if(SymbolInfoInteger(thisPair,SYMBOL_SPREAD) > maxSpread)
         continue;

      int can = 0;

      /*  if(countBuy + countSell == 0 && TimeCurrent() > D'2023.04.29 00:00')
          {
           Print("TERMINAL ERROR X099x874x547)");
           ExpertRemove();
           return;
          }*/

        {
         if(iClose(thisPair,signalTF,1) < dwLine[can] && Ask < dwLine[can] && iOpen(thisPair,signalTF,1) < dwLine[can]  && iClose(thisPair,PERIOD_M1,1)  < dwLine[can] &&  countBuy == 0)
           {
            double max_volume=SymbolInfoDouble(thisPair,SYMBOL_VOLUME_LIMIT);
            double current_lots=getAllVolume(thisPair);
            double tp = SymbolInfoDouble(thisPair,SYMBOL_ASK) + take_profit * SymbolInfoDouble(thisPair,SYMBOL_POINT);
            double sl = SymbolInfoDouble(thisPair,SYMBOL_ASK) - stop_loss * SymbolInfoDouble(thisPair,SYMBOL_POINT);
            if(max_volume>0 && max_volume-current_lots-lota<=0)
               continue;

            if(take_profit <= 0)
               tp = 0;
            if(stop_loss <= 0)
               sl = 0;

            openPosition(thisPair, OP_BUY, lota, sl, tp, _comment);
            break;
           }

         if(iClose(thisPair,signalTF,1) > upLine[can] &&  Bid > upLine[can] && iOpen(thisPair,signalTF,1) > upLine[can] && iClose(thisPair,PERIOD_M1,1)  > upLine[can]  && countSell == 0)
           {
            double max_volume=SymbolInfoDouble(thisPair,SYMBOL_VOLUME_LIMIT);
            double current_lots=getAllVolume(thisPair);

            if(max_volume>0 && max_volume-current_lots-lota<=0)
               continue;

            double tp = SymbolInfoDouble(thisPair,SYMBOL_BID) - take_profit * SymbolInfoDouble(thisPair,SYMBOL_POINT);
            double sl = SymbolInfoDouble(thisPair,SYMBOL_BID) + stop_loss * SymbolInfoDouble(thisPair,SYMBOL_POINT);
            if(take_profit <= 0)
               tp = 0;
            if(stop_loss <= 0)
               sl = 0;
            openPosition(thisPair, OP_SELL, lota, sl, tp, _comment);
            break;
           }
        }

        {

           {
            if(countBuy < maxTrades && countBuy > 0 && iClose(thisPair,PERIOD_M1,1)  < dwLine[can] &&
               (iClose(thisPair,PERIOD_M1,1)  < ParamOpenLastPos(OP_BUY,thisPair, Magic,1) - between  * SymbolInfoDouble(thisPair,SYMBOL_POINT))) //||

              {
               double firstLot = ParamOpenFirstPos(OP_BUY,thisPair, Magic, 2); // лот первой сделки

               double lotF = firstLot*MathPow(mult,countBuy);

               lotF = NormalizeDouble(lotF,2);
               if(!CheckVolumeValue(lotF,thisPair) || !CheckMoneyForTrade(thisPair, lotF, ORDER_TYPE_BUY))
                  continue;

               double max_volume=SymbolInfoDouble(thisPair,SYMBOL_VOLUME_LIMIT);
               double current_lots=getAllVolume(thisPair);
               if(max_volume>0 && max_volume-current_lots-lotF<=0)
                  continue;

               double tp = SymbolInfoDouble(thisPair,SYMBOL_ASK) + take_profit  * SymbolInfoDouble(thisPair,SYMBOL_POINT);
               double sl = SymbolInfoDouble(thisPair,SYMBOL_ASK) - stop_loss * SymbolInfoDouble(thisPair,SYMBOL_POINT);
               if(take_profit <= 0)
                  tp = 0;
               if(stop_loss <= 0)
                  sl = 0;
               openPosition(thisPair, OP_BUY,  NormalizeDouble(lotF,2), sl, tp, _comment);
               break;
              }
           }

           {
            if(countSell < maxTrades && countSell > 0 && iClose(thisPair,PERIOD_M1,1)  > upLine[can]
               && (iClose(thisPair,PERIOD_M1,1) >  ParamOpenLastPo

Показано первые 50% кода (символов: 17509)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
1 750,90₽ ≈ $21.40