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

hilotma ea.mq4

Похожие материалы по тегам

market crusher ea guidlines.txtMQL · 2 общих теговea_price_action_v6_grid.mq4MQL4 / MetaTrader 4 · 2 общих тегов#1.mtf_collider_h4_close_13_v18bar.mq4MQL4 / MetaTrader 4 · 1 общих теговea robofibo source v.11.2.mq4MQL4 / MetaTrader 4 · 1 общих теговthe gold reaper v4.1 mt5.mq4MQL4 / MetaTrader 4 · 1 общих теговsma crossover scalper ea for mt4.mq4MQL4 / MetaTrader 4 · 1 общих тегов
Вы автор или правообладатель?

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

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

О программе

Данный продукт представляет собой автоматический торговый советник (Expert Advisor) для платформы MetaTrader 4, написанный на языке MQL4. Советник использует два внешних индикатора — HILO channel OMA BT и TMA ATR Channel — для генерации торговых сигналов на покупку и продажу.

Программа поддерживает разнообразные настройки входа в сделки, включая расчёт лотов по деньгам, проценту от счёта или фиксированному значению, а также несколько режимов стоп-лосса и тейк-профита (фиксированные пипсы, по деньгам, по свечам, по ATR и по соотношению риск/прибыль).

В состав EA входят встроенные модули управления позициями: скользящий стоп (trailing stop), сеточная торговля (grid), безубыточность (breakeven), частичное закрытие, а также функция закрытия всех позиций по заданным условиям. Доступна фильтрация ордеров по символам и магическим числам, управление сессиями по времени и система уведомлений (десктоп, email, push).

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

НастройкаОписание
THilo Настройки Hilo — Заголовок раздела настроек Hilo.
TimeFrame Таймфрейм Hilo — Таймфрейм для расчётов индикатора Hilo (выбор из списка таймфреймов).
HighLowPeriod Период максимум/минимум — Период расчёта максимум/минимум для канала Hilo.
ClosePeriod Период закрытия — Период закрытия для расчёта канала Hilo.
OmaSpeed Скорость OMA — Скорость OMA — параметр сглаживания для расчёта канала Hilo.
OmaAdaptive Адаптивный OMA — Переключатель адаптивного режима OMA (Open Moving Average).
ShadowWidth Толщина теней свечей — Толщина теней свечей для отрисовки графика Hilo.
LineWidth Толщина линий — Толщина линий на графике Hilo.
Upcolor Цвет восходящих элементов — Цвет восходящих элементов графика Hilo.
Dncolor Цвет нисходящих элементов — Целый цвет для отрисовки нисходящих элементов графика Hilo.
Shcolor Цвет теней — Цвет теней свечей на графике Hilo.
ShowCandles Показать свечи — Переключатель отображения свечей на графике Hilo.
ShowLines Показать линии — Переключатель отображения линий на графике Hilo.
ShowArrows Показать стрелки — Переключатель отображения стрелок на графике Hilo.
WickWidth Толщина фитилей — Толщина фитилей свечей для отрисовки графика Hilo.
BodyWidth Толщина тела свечи — Толщина тела свечи для отрисовки графика Hilo.
UseAutoWidth Автоматическая ширина — Переключатель автоматической ширины свечей на графике Hilo.
alertsOn Включить оповещения — Главный переключатель включения оповещений о сигналах.
alertsOnCurrent Оповещения на текущем символе — Переключатель оповещений только на текущем символе/таймфрейме.
alertsMessage Сообщения-оповещения — Переключатель отображения текстовых сообщений-оповещений.
alertsSound Звуковые оповещения — Переключатель звуковых оповещений о сигналах.
alertsNotify Push-уведомления — Переключатель отправки push-уведомлений.
alertsEmail Email-уведомления — Переключатель отправки email-уведомлений о сигналах.
ArrowOnFirst Стрелки на первом баре — Переключатель отображения стрелок на первом баре.
UpArrowSize Размер стрелки вверх — Размер стрелки вверх на графике.
DnArrowSize Размер стрелки вниз — Размер стрелки вниз на графике.
UpArrowCode Код стрелки вверх — Код символа стрелки вверх для отображения на графике.
DnArrowCode Код стрелки вниз — Код символа стрелки вниз для отображения на графике.
UpArrowGap Отступ стрелки вверх — Отступ стрелки вверх от цены в процентах от диапазона.
DnArrowGap Отступ стрелки вниз — Отступ стрелки вниз от цены в процентах от диапазона.
UpArrowColor Цвет стрелки вверх — Цвет стрелки вверх на графике.
DnArrowColor Цвет стрелки вниз — Цвет стрелки вниз на графике.
Interpolate Интерполяция — Переключатель интерполяции значений на графике.
button_note1 Разделитель кнопки — Разделитель-примечание перед настройками кнопки.
btn_Subwindow Подокно кнопки — Индекс подокна для размещения кнопки (0 — основное окно).
btn_corner Угол кнопки — Угол размещения кнопки на графике (левый верхний, правый верхний, левый нижний, правый нижний).
btn_text Текст кнопки — Текст на кнопке графика.
btn_Font Шрифт кнопки — Шрифт текста кнопки на графике.
btn_FontSize Размер шрифта кнопки — Размер шрифта текста кнопки на графике.
btn_text_ON_color Цвет текста кнопки (активный) — Цвет текста кнопки в активном состоянии.
btn_text_OFF_color Цвет текста кнопки (неактивный) — Цвет текста кнопки в неактивном состоянии (целое число, соответствующее цвету).
btn_background_color Фон кнопки — Цвет фона кнопки на графике.
btn_border_color Рамка кнопки — Цвет рамки кнопки на графике.
button_x Координата X кнопки — Координата X размещения кнопки на графике.
button_y Координата Y кнопки — Координата Y размещения кнопки на графике.
btn_Width Ширина кнопки — Ширина кнопки на графике в пикселях.
btn_Height Высота кнопки — Высота кнопки на графике в пикселях.
button_note2 Разделитель кнопки 2 — Разделитель-примечание после настроек кнопки.
Ttma Настройки канала TMA ATR — Заголовок раздела настроек канала TMA ATR.
NormalTimeFrame Таймфрейм TMA ATR — Таймфрейм для расчётов канала TMA ATR (выбор из списка таймфреймов).
TMAPeriod Период TMA ATR — Период расчёта для индикатора TMA ATR Channel.
Price Тип цены TMA — Тип цены для расчётов канала TMA ATR (выбор из списка типов цены).
ATRPeriod Период ATR — Период ATR для расчёта волатильности в настройках канала TMA ATR.
TrendThreshold Порог тренда — Порог тренда для определения направления в канале TMA ATR.
ShowCenterLine Показать центральную линию — Переключатель отображения центральной линии канала TMA ATR.
ATRMultiplier Множитель ATR — Множитель ATR для расчёта уровня стоп-лосса или тейк-профита в режиме ATR.
ATRMultiplier2 Множитель ATR 2 — Второй множитель ATR, используемый в настройках канала TMA ATR.
ATRMultiplier3 Множитель ATR 3 — Третий множитель ATR, используемый в настройках канала TMA ATR.
ATRMultiplier4 Множитель ATR 4 — Четвёртый множитель ATR, используемый в настройках канала TMA ATR.
ATRMultiplier5 Множитель ATR 5 — Пятый множитель ATR, используемый в настройках канала TMA ATR.
ATRMultiplier6 Множитель ATR 6 — Шестой множитель ATR, используемый в настройках канала TMA ATR.
ATRMultiplier7 Множитель ATR 7 — Седьмой множитель ATR, используемый в настройках канала TMA ATR.
tma_alertsOn Оповещения TMA — Главный переключатель оповещений от канала TMA ATR.
tma_alertsMessage Сообщения TMA — Переключатель текстовых сообщений-оповещений от канала TMA ATR.
tma_alertsSound Звуковые оповещения TMA — Переключатель звуковых оповещений от канала TMA ATR.
tma_alertsEmail Email-уведомления TMA — Переключатель отправки email-уведомлений от канала TMA ATR.
MoveEndpointEveryTick Обновление конечной точки каждый тик — Переключатель обновления конечной точки канала TMA ATR на каждом тике.
MaxBarsBack Максимум баров назад — Максимальное количество баров для обработки данных TMA ATR.
T0 Настройки торговли — Заголовок раздела настроек торговли.
modeCalcLots Режим расчёта лотов — Режим расчёта лотов (по деньгам, по проценту от счёта, фиксированное значение).
userMoney Сумма для расчёта лота — Сумма в долларах для расчёта размера лота.
userBalancePer Процент баланса для лота — Процент от баланса счёта для расчёта размера лота.
userLots Фиксированный лот — Фиксированное значение лота при ручном режиме расчёта.
T01 Настройки тейк-профита — Заголовок раздела настроек тейк-профита.
takeProfitOn Включить тейк-профит — Переключатель включения тейк-профита.
modeTP Режим тейк-профита — Режим тейк-профита (фиксированные пипсы, по деньгам, по пипсам свечи, по ATR, по соотношению риск/прибыль).
userTPpips Пипсы тейк-профита — Количество пипсов для фиксированного тейк-профита.
userTPmoney Сумма для тейк-профита — Сумма в долларах для тейк-профита в режиме по деньгам.
uTP_ATRPeriod Период ATR для TP — Период ATR для расчёта уровня тейк-профита.
uTP_ATRmultiplier Множитель ATR для TP — Множитель ATR для расчёта уровня тейк-профита.
uTP_ATRShift Сдвиг ATR для TP — Сдвиг ATR для расчёта уровня тейк-профита.
uTP_Ratio Соотношение риск/прибыль — Соотношение риск/прибыль для расчёта тейк-профита.
T02 Настройки стоп-лосса — Заголовок раздела настроек стоп-лосса.
stopLossOn Включить стоп-лосс — Переключатель включения стоп-лосса.
modeSL Режим стоп-лосса — Режим стоп-лосса (фиксированные пипсы, по деньгам, по пипсам свечи, по ATR).
userSLpips Пипсы стоп-лосса — Количество пипсов для фиксированного стоп-лосса.
userSLmoney Сумма для стоп-лосса — Сумма в долларах для стоп-лосса в режиме по деньгам.
uATRPeriod Период ATR для SL — Период ATR для расчёта уровня стоп-лосса.
uATRmultiplier Множитель ATR для SL — Множитель ATR для расчёта уровня стоп-лосса.
uATRShift Сдвиг ATR для SL — Сдвиг ATR для расчёта уровня стоп-лосса.
TtpOptions Настройки закрытия всех позиций — Заголовок раздела настроек закрытия всех позиций.
closeAllControlON Контроль закрытия всех позиций — Переключатель включения контроля закрытия всех позиций.
closeBy Режим закрытия всех позиций — Режим закрытия всех позиций (по деньгам, по проценту от счёта, по пипсам).
closeAllMoney Закрытие по сумме прибыли — Сумма в долларах для закрытия всех позиций при достижении прибыли.
closeAllMoneyLoss Закрытие по сумме убытка — Сумма в долларах для закрытия всех позиций при достижении убытка.
closeByPipsWin Пипсы прибыли для закрытия — Количество пипсов прибыли для закрытия всех позиций.
closeByPipsLoss Пипсы убытка для закрытия — Количество пипсов убытка для закрытия всех позиций.
closeAllInOpositeSignal Закрытие при противоположном сигнале — Переключатель закрытия всех позиций при появлении противоположного сигнала.
Tbk Настройки безубыточности — Заголовок раздела настроек безубыточности.
breakevenOn Безубыточность — Переключатель включения функции безубыточности для открытых позиций.
Получить полный код

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

#property version "1.0"
#property strict

enum ModeSL {
  SL_FixPips,         // Fix Pips
  SL_byMoney,         // Money
  SL_PipsFromCandle,  // Pips from Candle
  SL_byATR,           // by ATR
};
enum ModeTP {
  TP_FixPips,         // Fix Pips
  TP_byMoney,         // Money
  TP_PipsFromCandle,  // Pips from Candle
  TP_byATR,           // by ATR
  TP_ByRatioRR        // by Ratio RR
};
enum TSLMode {
  byPips,  // By Pips
  byMA     // By Moving Average
};
enum ModeCalcLots {
  Money,           // by Money
  AccountPercent,  // by Account Percent
  FixLots          // Fix Lots
};
enum CloseAllMode {
  CloseByMoney,           // by Money
  CloseByAccountPercent,  // by Account Percent
  CloseByPips             // By Pips
};

enum eTimeFrames {
  current,  // Current TimeFrame
  m1,       // 1 minute
  m5,       // 5 minute
  m15,      // 15 minute
  m30,      // 30 minute
  h1,       // 1 hour
  h4,       // 4 hours
  d1,       // Daily
  w1,       // Weekly
  mm1,      // Monthly
  firstHT,  // First Higher timeframe
  secHT,    // Second Higher timeframe
  terHT,    // Third Higher timeframe
};
enum eTimeFrameNormal {
  normal_current,  // Current TimeFrame
  normal_m1,       // 1 minute
  normal_m5,       // 5 minute
  normal_m15,      // 15 minute
  normal_m30,      // 30 minute
  normal_h1,       // 1 hour
  normal_h4,       // 4 hours
  normal_d1,       // Daily
  normal_w1,       // Weekly
  normal_mm1,      // Monthly
};

enum eCorner {
  LU,  // Left Upper Chart Corner
  RU,  // Right Upper Chart Corner
  LL,  // Left Lower Chart Corner
  RL,  // Right Lower Chart Corner
};
enum eAppliedPrice {
  closePrice,     // Close price
  openPrice,      // Open price
  highPrice,      // High price
  lowPrice,       // Low price
  medianPrice,    // Median price
  typicalPrice,   // Typical price
  weightedPrice,  // Weighted price
};

input string      THilo                = "== Hilo Setup ==";  // == Hilo Setup ==
input eTimeFrames TimeFrame            = 0;
input int         HighLowPeriod        = 10;
input int         ClosePeriod          = 0;
input double      OmaSpeed             = 2.5;
input bool        OmaAdaptive          = true;
input int         ShadowWidth          = 6;
input int         LineWidth            = 2;
input color       Upcolor              = 7451452;
input color       Dncolor              = 3937500;
input color       Shcolor              = 8421504;
input bool        ShowCandles          = true;
input bool        ShowLines            = true;
input bool        ShowArrows           = true;
input int         WickWidth            = 1;
input int         BodyWidth            = 2;
input bool        UseAutoWidth         = true;
input bool        alertsOn             = true;
input bool        alertsOnCurrent      = false;
input bool        alertsMessage        = true;
input bool        alertsSound          = true;
input bool        alertsNotify         = false;
input bool        alertsEmail          = false;
input bool        ArrowOnFirst         = true;
input int         UpArrowSize          = 4;
input int         DnArrowSize          = 4;
input int         UpArrowCode          = 159;
input int         DnArrowCode          = 159;
input double      UpArrowGap           = 0.5;
input double      DnArrowGap           = 0.5;
input color       UpArrowColor         = 3329330;
input int         DnArrowColor         = 42495;
input bool        Interpolate          = true;
input string      button_note1         = "------------------------------";
input int         btn_Subwindow        = 0;
input eCorner     btn_corner           = 0;
input string      btn_text             = "HL oma";
input string      btn_Font             = "Arial";
input int         btn_FontSize         = 10;
input color       btn_text_ON_color    = 65280;
input int         btn_text_OFF_color   = 255;
input color       btn_background_color = 6908265;
input color       btn_border_color     = 0;
input int         button_x             = 850;
input int         button_y             = 20;
input int         btn_Width            = 70;
input int         btn_Height           = 20;
input string      button_note2         = "------------------------------";

input string           Ttma                  = "== TMA ATR channel Setup ==";  // == TMA ATR channel Setup ==
input eTimeFrameNormal NormalTimeFrame       = 0;
input int              TMAPeriod             = 20;
input eAppliedPrice    Price                 = 0;
input int              ATRPeriod             = 100;
input double           TrendThreshold        = 0.25;
input bool             ShowCenterLine        = true;
input double           ATRMultiplier         = 1.618;
input double           ATRMultiplier2        = 2.0;
input double           ATRMultiplier3        = 2.236;
input double           ATRMultiplier4        = 2.5;
input double           ATRMultiplier5        = 2.618;
input double           ATRMultiplier6        = 3.0;
input double           ATRMultiplier7        = 3.236;
input bool             tma_alertsOn          = false;
input bool             tma_alertsMessage     = false;
input bool             tma_alertsSound       = false;
input bool             tma_alertsEmail       = false;
input bool             MoveEndpointEveryTick = false;
input int              MaxBarsBack           = 5000;

input string       T0                      = "== Trade Setup ==";        // == Trade Setup ==
input ModeCalcLots modeCalcLots            = FixLots;                    // Mode to Calc Lots:
input double       userMoney               = 10;                         // Setup Lots by "Money":
input double       userBalancePer          = 0.1;                        // Setup Lots by "Account Percent":
input double       userLots                = 0.01;                       // Setup Lots by "User Lots":
input string       T01                     = "- Take Profit -";          // Setup Hard Take Profit
input bool         takeProfitOn            = true;                       // Take Profit On:
input ModeTP       modeTP                  = TP_FixPips;                 // Mode Take Profit:
input int          userTPpips              = 20;                         // Pips TP
input double       userTPmoney             = 15;                         // Money TP
input int          uTP_ATRPeriod           = 10;                         // TP ATR periods:
input double       uTP_ATRmultiplier       = 1.5;                        // TP ATR Multiplier:
input int          uTP_ATRShift            = 1;                          // TP ATR shift:
input double       uTP_Ratio               = 2.0;                        // TP Ratio RR:
input string       T02                     = "- Stop Loss -";            // Setup hard Stop Loss
input bool         stopLossOn              = true;                       // Stop Loss On:
input ModeSL       modeSL                  = SL_FixPips;                 // Mode Stop Loss:
input int          userSLpips              = 20;                         // Pips SL
input double       userSLmoney             = 15;                         // Money SL
input int          uATRPeriod              = 10;                         // SL ATR periods:
input double       uATRmultiplier          = 1.5;                        // SL ATR Multiplier:
input int          uATRShift               = 1;                          // SL ATR shift:
input string       TtpOptions              = "== Close All Options ==";  // == Close All Options ==
input bool         closeAllControlON       = false;                      // Close All Control ON:
input CloseAllMode closeBy                 = CloseByMoney;               // Close All Mode:
input double       closeAllMoney           = 100;                        // Close by Money $:
input double       closeAllMoneyLoss       = -100;                       // Close by Money Lossing $:
input double       accountPerWin           = 1;                          // Account Percent Win:
input double       accountPerLos           = -1;                         // Account Percent Loss:
input double       closeByPipsWin          = 10;                         // Close Pips Win:
input double       closeByPipsLoss         = 10;                         // Close Pips Loss:
input bool         closeAllInOpositeSignal = false;                      // CLose All In Oposite Signal
string             Tpc                     = "== Partial Close ==";      // == Partial Close ==
bool               partialCloseOn          = false;                      // Use Partial Close ?
double             userPartialClosePercent = 50;                         // Partial Close Percent:
double             userPartialClosePips    = 20;                         // Partial Close Pips:
input string       Tbk                     = "== Breakeven Setup ==";    // == Breakeven Setup ==
input bool         breakevenOn             = false;                      // Use Breakeven?
input double       userBkvPips             = 3;                          // Breakeven Pips
input string       tTailingStop            = "== TailingStop Setup ==";  // == TailingStop Setup ==
input bool         TslON                   = false;                      // TSL ON:
TSLMode            userTslMode             = byPips;                     // TSL Mode:
input int          userTslInitialStep      = 1;                          // TSL Initial Step:
input int          userTslStep             = 1;                          // TSL Step:
input int          userTslDistance         = 20;                         // TSL Distance:
input string       tGrid                   = "== Grid Setup ==";         // == Grid Setup ==
input bool         GridON                  = false;                      // Use Grid:
input int          GridUser_maxCount       = 5;                          // Max attempts:
input double       GridUser_maxLot         = 10;                         // Max lot value:
input double       GridUser_multiplier     = 1.5;                        // Multiplier:
input int          GridUser_gap            = 30;                         // Gap betwen orders (pips):
input bool         closeGridOn             = true;                       // Use Close Grid?
input double       closeGridTP             = 100;                        // Take Profit Grid $
input double       closeGridSL             = -100;                       // Stop Loss Grid -$
input string       T1                      = "== Timer ==";              // Timer
input string       timeStart               = "00:00:00";                 // Time Start GMT
input string       timeEnd                 = "23:59:59";                 // Time End GMT
input string       TZ                      = "== Notifications ==";      // Notifications
input bool         notifications           = false;                      // Notifications On
input bool         desktop_notifications   = false;                      // Desktop MT4 Notifications
input bool         email_notifications     = false;                      // Email Notifications
input bool         push_notifications      = false;                      // Push Mobile Notifications
input int          magico                  = 2022;                       // Magic Number:
string             TFilters                = "== Filters Orders ==";     // == Filters Orders ==
bool               filterSymbolsOn         = true;                       // Use symbols filter?
string             SymbolsList             = "GBPUSD,EURUSD";            // Symbols (separate by comma ","):
bool               filterMagicsOn          = true;                       // Use magic number filter?
string             MagicsList              = "2022";                     // Magics numbers (separate by comma ","):

interface iIndicators
{
  double calculate(int bufferNumber, int shift);
};
interface IOrders
{
 public:
  virtual void Add()     = 0;
  virtual void Release() = 0;

  virtual bool AddOrder()    = 0;
  virtual bool DeleteOrder() = 0;
  virtual bool Select()      = 0;
};
class Order
{
  int      _id;
  string   _symbol;
  double   _price;
  double   _sl;
  double   _tp;
  double   _lot;
  int      _type;
  int      _magic;
  string   _comment;
  string   _strategy;
  datetime _expireTime;
  datetime _signalTime;
  double   _profit;
  double   _tslNext;
  bool     _bkvWasDoIt;
  int      _countPartials;

 public:
  Order(
      int      id,
      string   symbol,
      double   price,
      double   sl,
      double   tp,
      double   lot,
      int      type,
      int      magic,
      string   comment,
      string   strategy,
      datetime expireTime,
      datetime signalTime,
      double   profit,
      double   bkvWasDoIt,
      int      countPartials) : _id(id),
                           _symbol(symbol),
                           _price(price),
                           _sl(sl),
                           _tp(tp),
                           _lot(lot),
                           _type(type),
                           _magic(magic),
                           _comment(comment),
                           _strategy(strategy),
                           _expireTime(expireTime),
                           _signalTime(signalTime),
                           _profit(profit),
                           _bkvWasDoIt(bkvWasDoIt),
                           _countPartials(countPartials) {}

  Order() {}
  ~Order() {}

	Order* id(int id){_id=id; return &this;}
	Order* symbol(string symbol){_symbol=symbol; return &this;}
	Order* price(double price){_price=price; return &this;}
	Order* sl(double sl){_sl=sl; return &this;}
	Order* tp(double tp){_tp=tp; return &this;}
	Order* lot(double lot){_lot=lot; return &this;}
	Order* type(int type){_type=type; return &this;}
	Order* magic(int magic){_magic=magic; return &this;}
	Order* comment(string comment){_comment=comment; return &this;}
	Order* expireTime(datetime expireTm){_expireTime=expireTm; return &this;}
	Order* signalTime(datetime signalTm){_signalTime=signalTm; return &this;}
	Order* profit(double profit){_profit=profit; return &this;}
	Order* strategy(string strategy){_strategy=strategy; return &this;}
	Order* tslNext(double tslNext){_tslNext=tslNext; return &this;}
	Order* breakevenWasDoIt(bool bkvWasDoIt){_bkvWasDoIt=bkvWasDoIt; return &this;}
	Order* countPartials(int count){_countPartials=_countPartials + count; return &this;}

   int            id()               { return _id; }
   string         symbol()           { return _symbol; }
   double         price()            { return _price; }
   double         sl()               { return _sl; }
   double         tp()               { return _tp; }
   double         lot()              { return _lot; }
   int            type()             { return _type; }
   int            magic()            { return _magic; }
   string         comment()          { return _comment; }
   string         strategy()         { return _strategy; }
   datetime       expireTime()       { return _expireTime; }
   datetime       signalTime()       { return _signalTime; }
   double         profit()           { if (OrderSelect(_id, SELECT_BY_TICKET)) return OrderProfit(); return -1; }
   double         tslNext()          { return _tslNext; }
   double         breakevenWasDoIt() { return _bkvWasDoIt; }
   int            countPartials()    { return _countPartials; }
};
class FilterBySymbols
{
   string _symbols[];

  public:
   FilterBySymbols(string userSymbols) { getSymbols(userSymbols); }
   ~FilterBySymbols() { ; }

   void getSymbols(string userSymbols)
   {
      string Simbolos[];
      string sep = ",";
      ushort u_sep;
      u_sep = StringGetCharacter(sep, 0);
      int k = StringSplit(userSymbols, u_sep, Simbolos);
      ArrayResize(_symbols, ArrayRange(Simbolos, 0), 0);
      for (int i = 0; i < ArrayRange(Simbolos, 0); i++)
      {
         _symbols[i] = Simbolos[i];
      }
      printSymbols();
   }

   bool control(const string symbolToControl)
   {
      if (ArraySize(_symbols) > 0)
      {
         for (int i = 0; i < ArraySize(_symbols); i++)
         {
            if (_symbols[i] == symbolToControl)
            {
               return true;
            }
         }
      }

      return false;
   }

   void printSymbols()
   {
      for (int i = 0; i < ArraySize(_symbols); i++)
      {
         Print(_symbols[i]);
      }
   }

};
class FilterByMagics
{
   int _magics[];

  public:
   FilterByMagics(string userMagics) { getMagics(userMagics); }
   ~FilterByMagics() { ; }

   void getMagics(string userMagics)
   {
      string Magicos[];
      string sep = ",";
      ushort u_sep;
      u_sep = StringGetCharacter(sep, 0);
      int k = StringSplit(userMagics, u_sep, Magicos);
      ArrayResize(_magics, ArrayRange(Magicos, 0), 0);
      for (int i = 0; i < ArrayRange(Magicos, 0); i++)
      {
         _magics[i] = (int)Magicos[i];
      }
      if (ArrayRange(_magics, 0) > 0)
      {
         ArraySort(_magics, WHOLE_ARRAY, 0, MODE_ASCEND);
      }
      printMagics();
   }

   bool control(const int magicToControl)
   {
      if (ArraySize(_magics) > 0)
      {			
         int p = ArrayBsearch(_magics, magicToControl, WHOLE_ARRAY, 0, MODE_ASCEND);
			if (_magics[p] == magicToControl)
         {
            return true;
         }
      }

      return false;
   }

   void printMagics()
   {
      for (int i = 0; i < ArraySize(_magics); i++)
      {
         Print(_magics[i]);
      }
   }

};
class OrdersList
{
   Order*          orders[];
   bool            _filterByMagicOn;
   bool            _filterBySymbolsOn;
   FilterByMagics* _magics;
   FilterBySymbols* _symbols;

  public:
  OrdersList(){;}
   OrdersList(bool uFilterByMagicOn, string uMagics, bool uFilterBySymbolsOn, string uSymbols)
   {
		_filterByMagicOn = uFilterByMagicOn;
		_filterBySymbolsOn = uFilterBySymbolsOn;
      _magics = new FilterByMagics(uMagics);
      _symbols = new FilterBySymbols(uSymbols);

      Print("New OrderList Created");
   }
   ~OrdersList() 
	{ 
		delete _magics;
		delete _symbols;
		clearList(); 
	}

void setOrdersList(bool magicOn, string magics, bool symbolsOn, string symbols)
{
		_filterByMagicOn = magicOn;
		_filterBySymbolsOn = symbolsOn;
      _magics = new FilterByMagics(magics);
      _symbols = new FilterBySymbols(symbols);

}

   bool AddOrder(Order* order)
   {
      int t = ArraySize(orders);
      if (ArrayResize(orders, t + 1))
      {
         orders[t] = order;
         return true;
      }

      return false;
   }

   void GetMarketOrders()
   {
      for (int i = OrdersTotal() - 1; i >= 0; i--)
      {
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
         {
            if (_filterByMagicOn) if (!_magics.control(OrderMagicNumber())) { continue; }
            if (_filterBySymbolsOn) if (!_symbols.control(OrderSymbol())) { continue; }

            if (exist(OrderTicket()) == true) { continue; }

            Order* newOrder = new Order();
            newOrder
                .id(OrderTicket())
                .symbol(OrderSymbol())
                .price(OrderOpenPrice())
                .sl(OrderStopLoss())
                .tp(OrderTakeProfit())
                .lot(OrderLots())
                .type(OrderType())
                .magic(OrderMagicNumber())
                .comment(OrderComment())
                .expireTime(OrderExpiration())
                .profit(OrderProfit())
                .breakevenWasDoIt(false)
                .countPartials(0);

            if (AddOrder(newOrder))
            {
               PrintOrder(i);
            }
         }
      }
   }

   bool GetLastMarketOrder()
   {
      for (int i = OrdersTotal() - 1; i >= 0; i--)
      {
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
         {
            if (_filterByMagicOn) if(!_magics.control(OrderMagicNumber())) { continue; }
            if (_filterBySymbolsOn) if (!_symbols.control(OrderSymbol())) { continue; }
            if (exist(OrderTicket()) == true) { continue; }

            Order* newOrder = new Order();
            newOrder
                .id(OrderTicket())
                .symbol(OrderSymbol())
                .price(OrderOpenPrice())
                .sl(OrderStopLoss())
                .tp(OrderTakeProfit())
                .lot(OrderLots())
                .type(OrderType())
                .magic(OrderMagicNumber())
                .comment(OrderComment())
                .expireTime(OrderExpiration())
                .profit(OrderProfit())
                .breakevenWasDoIt(false)
                .countPartials(0);

            if (AddOrder(newOrder))
            {
                  Print(__FUNCTION__," ","* Nueva Orden De Mercado * ",id(i), "magic: ",magic(i));

                  return true;
            }
         }
         return false;
      }
      return false;
   }

   bool exist(int id)
   {
      for (int i = qnt() - 1; i >= 0; i--)
      {
         if (id(i) == id)
         {
            return true;
         }
      }
      return false;
   }

   bool deleteOrder(int index)
   {
      if (notOverFlow(index))
      {
         delete orders[index];
      }

      if (qnt() > index)
      {
         for (int i = index; i < qnt() - 1; i++)
         {
            orders[i] = orders[i + 1];
         }
         ArrayResize(orders, qnt() - 1);
         return true;
      }

      return false;
   }

   void clearList()
   {
      for (int i = 0; i < qnt(); i++)
      {
         if (CheckPointer(orders[i]) != POINTER_INVALID)
         {
            deleteOrder(i);
         }
      }
   }

   Order* last()
   {
      int lastIndex = ArraySize(orders) - 1;
      if (lastIndex == -1)
      {
         return NULL;
      }
      return GetPointer(orders[lastIndex]);
   }

   Order* index(int in)
   {
      return GetPointer(orders[in]);
   }

   int lastId()
   {
      int lastIndex = ArraySize(orders) - 1;
      return orders[lastIndex].id();
   }

   bool notOverFlow(int index)
   {
      if (index > ArraySize(orders) - 1) return false;
      if (index < 0) return false;
      if (CheckPointer(orders[index]) == POINTER_INVALID) return false;

      return true;
   }

   int qnt()
   {
      return ArraySize(orders);
   }

   int id(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].id();
      }
      return -1;
   }
   string symbol(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].symbol();
      }
      return "";
   }
   double price(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].price();
      }
      return -1;
   }
   double sl(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].sl();
      }
      return -1;
   }
   double tp(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].tp();
      }
      return -1;
   }
   double lot(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].lot();
      }
      return -1;
   }
   int magic(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].magic();
      }
      return -1;
   }
   datetime expire(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].expireTime();
      }
      return -1;
   }
   datetime signalTime(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].signalTime();
      }
      return -1;
   }
   string comment(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].comment();
      }
      return "";
   }
   ENUM_ORDER_TYPE type(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].type();
      }
      return -1;
   }
   double profit(int index)
   {
      if (notOverFlow(index))
      {
         return orders[index].profit();
      }
      return -1;
   }

  bool isClose(int index)
  {
    if (notOverFlow(index))
    {
      if (OrderSelect(id(index), SELECT_BY_TICKET))
      {
        if (OrderCloseTime() != 0) return true;
      }
    }
    return false;
  }

  void cleanCloseOrders()
  {
    if (qnt() == 0)
    {
      return;
    }

    for (int i = 0; i < qnt(); i++)
    {
      if (isClose(i))
      {
        deleteOrder(i);
      }
    }
  }

  int closeAllInList()
  {
    cleanCloseOrders();
    int errors = 0;

    for (int i = 0; i < ArraySize(orders); i++)
    {
      int tk;
      if (isClose(i))
      {
        continue;
      }
      if (CheckPointer(orders[i]) != POINTER_INVALID)
      {
        tk = orders[i].id();
      } else
      {
        continue;
      }
      if (OrderSelect(tk, SELECT_BY_TICKET))
      {
        double ask        = SymbolInfoDouble(OrderSymbol(), SYMBOL_ASK);
        double bid        = SymbolInfoDouble(OrderSymbol(), SYMBOL_BID);
        double closePrice = OrderType() == OP_BUY ? bid : ask;
        if (!OrderClose(OrderTicket(), OrderLots(), closePrice, 1000, clrNONE))
        {
          Print(__FUNCTION__, " ", "Error in close order ", orders[i].id(), ": ", GetLastError());
          errors++;
        }
      }
    }

    cleanCloseOrders();

    return errors;
  }

  void PrintOrder(const int index)
  {
    if (!notOverFlow(index))
    {
      return;
    }
    if (CheckPointer(orders[index]) == POINTER_INVALID)
    {
      return;
    }

      Print("Order ", index, " id: ",          orders[index].id());
      Print("Order ", index, " symbol: ",      orders[index].symbol());
      Print("Order ", index, " type: ",        orders[index].type());
      Print("Order ", index, " lot: ",         orders[index].lot());
      Print("Order ", index, " price: ",       orders[index].price());
      Print("Order ", index, " sl: ",          orders[index].sl());
      Print("Order ", index, " tp: ",          orders[index].tp());
      Print("Order ", index, " magic: ",       orders[index].magic());
      Print("Order ", index, " comment: ",     orders[index].comment());
      Print("Order ", index, " strategy: ",    orders[index].strategy());
      Print("Order ", index, " expire time: ", orders[index].expireTime());
      Print("Order ", index, " signal time: ", orders[index].signalTime());
      Print("Order ", index, " profit: ",      orders[index].profit());
      Print("Order ", index, " countPartials: ", orders[index].countPartials());

  }

  void PrintList()
  {
    for (int i = 0; i < qnt(); i++)
    {
      PrintOrder(i);
    }
  }
};
OrdersList mainOrders(filterMagicsOn, (string)magico, filterSymbolsOn, _Symbol);

interface iConditions
{
  bool evaluate();
};
class ConcurrentConditions
{
 protected:
  iConditions* _conditions[];

 public:
  ConcurrentConditions(void) {}
  ~ConcurrentConditions(void) { releaseConditions(); }

  void releaseConditions()
  {
    for (int i = 0; i < ArraySize(_conditions); i++)
    {
      delete _conditions[i];
    }
    ArrayFree(_conditions);
  }

  void AddCondition(iConditions* condition)
  {
    int t = ArraySize(_conditions);
    ArrayResize(_conditions, t + 1);
    _conditions[t] = condition;
  }

  bool EvaluateConditions(void)
  {
    for (int i = 0; i < ArraySize(_conditions); i++)
    {
      if (!_conditions[i].evaluate())
      {
        return false;
      }
    }
    return true;
  }
};
class ConditionMatchPrice : public iConditions
{
  string _symbol;
  string _side;
  double _price;
  int    _mode;  // 0: Ask>=Price & Bid <=Price , 1: Ask <= Price && Bid >= Price

 public:
  ConditionMatchPrice(string Symbol, string Side, double Price, int Mode)
  {
    _symbol = Symbol;
    _side   = Side;
    _price  = Price;
    _mode   = Mode;
  }
  ~ConditionMatchPrice() { ; }

  void   side(string inpside) { _side = inpside; }
  string side(void) { return _side; }
  void   symbol(string inpsymbol) { _symbol = inpsymbol; }
  string symbol(void) { return _symbol; }
  void   price(double inpprice) { _price = inpprice; }
  double price(void) { return _price; }
  void   mode(int inpmode) { _mode = inpmode; }
  int    mode(void) { return _mode; }

  bool evaluate()
  {
    double ask = SymbolInfoDouble(_symbol, SYMBOL_ASK);
    double bid = SymbolInfoDouble(_symbol, SYMBOL_BID);

    if (_mode == 0)
    {
      if (_side == "buy")
      {
        if (ask >= _price)
        {
          return true;
        }
        return false;
      }
      if (_side == "sell")
      {
        if (bid <= _price)
        {
          return true;
        }
        return false;
      }
    }

    if (_mode == 1)
    {
      if (_side == "buy")
      {
        if (ask <= _price)
        {
          return true;
        }
        return false;
      }
      if (_side == "sell")
      {
        if (bid >= _price)
        {
          return true;
        }
        return false;
      }
    }
    return false;
  }
};
class ConditionMaxLot : public iConditions
{
  double _maxLot;
  double _lot;

 public:
  ConditionMaxLot(double MaxLot, double Lot)
  {
    _maxLot = MaxLot;
    _lot    = Lot;
  }
  ~ConditionMaxLot() { ; }
  void lot(double inplot) { _lot = inplot; }

  bool evaluate()
  {
    if (_maxLot >= _lot)
    {
      return true;
    }
    return false;
  }
};
class ConditionOrderCount : public iConditions
{
  OrdersList* _orders;
  int         _maxQnt;

 public:
  ConditionOrderCount(OrdersList* Orders, int MaxQnt)
  {
    _orders = Orders;
    _maxQnt = MaxQnt;
  }
  ~ConditionOrderCount() { ; }

  bool evaluate()
  {
    if (_orders.qnt() < _maxQnt)
    {
      return true;
    }
    return false;
  }
};

interface iActions
{
  bool doAction();
};
class MoveSL : public iActions
{
  Order* _order;
  double _newSL;

 public:
  MoveSL() { ; }
  ~MoveSL() { ; }

  MoveSL* order(Order* or)
  {
    _order = or ;
    return &this;
  }
  MoveSL* newSL(double newSL)
  {
    _newSL = newSL;
    return &this;
  }

  bool controlPointer(Order* or)
  {
    if (CheckPointer(or))
    {
      return true;
    } else
    {
      Print("Order Pointer Invalid");
      return false;
    }
  }

  bool doAction()
  {
    if (!controlPointer(_order))
    {
      Print(__FUNCTION__, " ", "Can't Move Stop Loss");
      return false;
    }
    if (OrderSelect(_order.id(), SELECT_BY_TICKET))
    {
      if (OrderCloseTime() > 0)
      {
        Print(__FUNCTION__, " ", "Order are closed ", _order.id());
        return false;
      }

      if (OrderModify(_order.id(), OrderOpenPrice(), _newSL, OrderTakeProfit(), OrderExpiration(), clrNONE))
      {
        _order.sl(_newSL);
        _order.breakevenWasDoIt(true);
        Print(__FUNCTION__, " ", _order.id(), " Modify: new SL: ", _newSL);
        return true;
      }

    } else
    {
      Print(__FUNCTION__, " ", "Can't Select the order ", _order.id());
    }

    return false;
  }
};
MoveSL* breackevenAction;

class PartialClose : public iActions
{
  Order* _order;
  double _percentToClose;

 public:
  PartialClose() { ; }
  ~PartialClose() { ; }

  PartialClose* order(Order* or)
  {
    _order = or ;
    return &this;
  }
  PartialClose* percent(double percentToClose)
  {
    _percentToClose = percentToClose;
    return &this;
  }

  bool controlPointer(Order* or)
  {
    if (CheckPointer(or))
    {
      return true;
    } else
    {
      Print("Order Pointer Invalid");
      return false;
    }
  }

  double lots()
  {
    return NormalizeDouble((_order.lot() * _percentToClose / 100), 2);
  }

  double price()
  {
    double ask = SymbolInfoDouble(_order.symbol(), SYMBOL_ASK);
    double bid = SymbolInfoDouble(_order.symbol(), SYMBOL_BID);

    if (_order.type() == OP_BUY)
    {
      return bid;
    }
    if (_order.type() == OP_SELL)
    {
      return ask;
    }
    return 0;
  }

  bool doAction()
  {
    if (!controlPointer(_order))
    {
      Print(__FUNCTION__, " ", "Can't Take Partial");
      return false;
    }
    if (OrderSelect(_order.id(), SELECT_BY_TICKET))
    {
      if (OrderCloseTime() > 0)
      {
        Print(__FUNCTION__, " ", "Order are closed ", _order.id());
        return false;
      }

      if (OrderClose(_order.id(), lots(), price(), 1000, clrNONE))
      {
        _order.countPartials(1);

        changeTk(_order.id());

        Print(__FUNCTION__, " ", _order.id(), " Partial TP taked ");
        return true;
      }

    } else
    {
      Print(__FUNCTION__, " ", "Can't Select the order ", _order.id());
    }

    return false;
  }

  void changeTk(int tk)
  {
    if (OrderSelect(tk, SELECT_BY_TICKET))
    {
      datetime dt     = OrderCloseTime();
      string   coment = OrderComment();
      int      pos    = StringFind(coment, "#") + 1;
      string   newId  = StringSubstr(coment, pos, StringLen(coment));
      _order.id((int)newId);
    }
  }
};
PartialClose* partialCloseAction;

class SendNewOrder : public iActions
{
 private:
  Order* newOrder;

 public:
  SendNewOrder(string side, double lots, string symbol = "", double price = 0, double sl = 0, double tp = 0, int magic = 0, string coment = "", datetime expire = 0)
  {
    string _symbol = setSymbol(symbol);
    double _price  = setPrice(side, price, _symbol);
    int    _type   = SetType(side, price, _symbol);
    if (_type == -1)
    {
      Print(__FUNCTION__, " ", "Imposible to set OrderType");
      return;
    }

    newOrder = new Order();

    newOrder
        .id(OrderTicket())
        .symbol(_symbol)
        .type(_type)
        .price(_price)
        .sl(sl)
        .tp(tp)
        .lot(lots)
        .magic(magic)
        .comment(coment)
        .expireTime(expire)
        .profit(0);
  }

  ~SendNewOrder()
  {
    delete newOrder;
  }

  string setSymbol(string sim)
  {
    if (sim == "")
    {
      return Symbol();
    }
    return sim;
  }

  double setPrice(string side, double pr, string sym)
  {
    if (pr == 0)
    {
      if (side == "buy")
      {
        return SymbolInfoDouble(sym, SYMBOL_ASK);
      }
      if (side == "sell")
      {
        return SymbolInfoDouble(sym, SYMBOL_BID);
      }
    }

    return pr;
  }

  int SetType(string side, double priceClient, string sym)
  {
    double ask = SymbolInfoDouble(sym, SYMBOL_ASK);
    double bid = SymbolInfoDouble(sym, SYMBOL_BID);

    if (priceClient == 0)
    {
      if (side == "buy")
      {
        return (int)OP_BUY;
      }
      if (side == "sell")
      {
        return (int)OP_SELL;
      }
    } else
    {
      if (side == "buy")
      {
        if (priceClient > ask)
        {
          return (int)OP_BUYSTOP;
        }
        if (priceClient < ask)
        {
          return (int)OP_BUYLIMIT;
        }
      }
      if (side == "sell")
      {
        if (priceClient > bid)
        {
          return (int)OP_SELLLIMIT;
        }
        if (priceClient < bid)
        {
          return (int)OP_SELLSTOP;
        }
      }
    }

    return -1;
  }

  bool doAction()
  {
    int tk = OrderSend(newOrder.symbol(), newOrder.type(), newOrder.lot(), newOrder.price(), 1000, newOrder.sl(), newOrder.tp(), newOrder.comment(), newOrder.magic(), newOrder.expireTime(), clrNONE);

    if (tk < 0)
    {
      Print(__FUNCTION__, " ", "Connot Send Order, error: ", GetLastError());
      return false;
    }

    return true;
  }

  Order* lastOrder()
  {
    return GetPointer(newOrder);
  }
};
SendNewOrder* actionSendOrder;

class Grid
{
  ConcurrentConditions conditionsToOpenNewTrade;
  ConcurrentConditions conditionsToCloseGrid;
  ConditionMatchPrice* cdMatchPrice;
  ConditionOrderCount* cdMaxOrders;
  ConditionMaxLot*     cdMaxLot;
  SendNewOrder*        openTrade;

  string     _symbol;
  string     _side;
  double     _nextPrice;
  double     _lastPrice;
  double     _gap;
  double     _multiplier;
  int        _maxQnt;
  double     _maxLot;
  double     _initialLot;
  double     _nextLot;
  int        _qnt;
  bool       _active;
  int        _magico;
  OrdersList gridOrders;

 public:
  Grid(string Symbol, string Side, double LastPrice, double Gap, double Multiplier, int MaxQnt, double MaxLot, double InitialLot, int magic, bool simbolFilterOn = true, bool magicFilterOn = true)
  {
    _symbol     = Symbol;
    _side       = Side;
    _lastPrice  = LastPrice;
    _gap        = Gap;
    _nextPrice  = nextPrice(LastPrice);
    _multiplier = Multiplier;
    _maxQnt     = MaxQnt + 1;
    _maxLot     = MaxLot;
    _initialLot = InitialLot;
    _nextLot    = nextLot();
    _magico     = magic;

    Print(_symbol);
    Print(_side);
    Print(_lastPrice);
    Print(_nextPrice);
    Print(_gap);
    Print(_multiplier);
    Print(_maxQnt);
    Print(_maxLot);
    Print(_initialLot);
    Print(_nextLot);

    gridOrders.setOrdersList(magicFilterOn, IntegerToString(_magico), simbolFilterOn, _symbol);
    gridOrders.GetLastMarketOrder();

    cdMatchPrice = new ConditionMatchPrice(_symbol, _side, _nextPrice, 1);
    cdMaxOrders  = new ConditionOrderCount(GetPointer(gridOrders), _maxQnt);
    cdMaxLot     = new ConditionMaxLot(_maxLot, _nextLot);

    cdMaxLot.lot(_nextLot);
    cdMatchPrice.price(_nextPrice);

    conditionsToOpenNewTrade.AddCondition(cdMatchPrice);
    conditionsToOpenNewTrade.AddCondition(cdMaxOrders);
    conditionsToOpenNewTrade.AddCondition(cdMaxLot);
  }
  ~Grid()
  {
    delete cdMatchPrice;
    delete cdMaxOrders;
    delete cdMaxLot;
    delete openTrade;
  }

  void lastPrice(int inplastPrice) { _lastPrice = inplastPrice; }
  bool active(void)
  {

    if (gridOrders.profit(0) < 0)
    {
      _active = true;
    } else
    {
      _active = false;
    }
    return _active;
  }
  double nextPrice(double inpLastPrice)
  {
    double mPoint = MarketInfo(_symbol, MODE_POINT);

    if (_side == "buy") _nextPrice = inpLastPrice - (_gap * mPoint * 10);
    if (_side == "sell") _nextPrice = inpLastPrice + (_gap * mPoint * 10);

    return _nextPrice;
  }
  void   gap(double inpGap) { _gap = inpGap; }
  void   multiplier(double inpmultiplier) { _multiplier = inpmultiplier; }
  void   maxQnt(int inpmaxQnt) { _maxQnt = inpmaxQnt; }
  void   maxLot(double inpmaxLot) { _maxLot = inpmaxLot; }
  double maxLot() { return _maxLot; }
  void   side(string inpside) { _side = inpside; }
  void   symbol(string inpsymbol) { _symbol = inpsymbol; }
  int    qnt()
  {
    return gridOrders.qnt();
  }
  double nextLot(void)
  {
    return NormalizeDouble(_initialLot * pow(_multiplier, qnt()), 2);
  };

  double profit()
  {
    double gridResult = 0;
    Print(__FUNCTION__, " ", "qnt()", " ", qnt());

    for (int i = 0; i < qnt(); i++)
    {
      if (CheckPointer(gridOrders.index(i)) != POINTER_INVALID)
        gridResult += gridOrders.profit(i);

      Print(__FUNCTION__, " ", "gridResult", " ", gridResult);
    }
    return gridResult;
  }

  void doGrid()
  {
    if (conditionsToOpenNewTrade.EvaluateConditions())
    {
      if (_side == "buy")
      {
        openTrade = new SendNewOrder("buy", Lots(), "", 0, SL("buy"), TP("buy"), _magico);
        if (openTrade.doAction())
        {
          Print("pointer de la ultima orden: ", openTrade.lastOrder());

          if (gridOrders.GetLastMarketOrder())
            setNextTrade();
        }
        delete openTrade;
      }

      if (_side == "sell")
      {
        openTrade = new SendNewOrder("sell", Lots(), "", 0, SL("sell"), TP("sell"), _magico);
        if (openTrade.doAction())
        {

          if (gridOrders.GetLastMarketOrder())
            setNextTrade();
        }
        delete openTrade;
      }
    }
  }

  void setNextTrade()
  {
    nextP

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

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

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

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

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

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

Стоимость полного кода
5 389,60₽ ≈ $65.88