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

h1.mq4

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

xauusd_gold_perfect.mq4MetaTrader 4 · 1 общих теговtm sniper pro.txtTradingView · 1 общих теговsource code of grid with 100 pips stop loss.mq4MetaTrader 4 · 1 общих теговsniper pro.mq5MetaTrader 5 · 1 общих теговpro +.txtTradingView · 1 общих теговofada_gold_trader_v230.mq5MetaTrader 5 · 1 общих тегов
Вы автор или правообладатель?

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

Получить полный код

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

input string EA = "Общие настройки советника";
input double Lot = 0.2;
input bool One_order_per_direction = true;
input int Max_orders_per_direction = 50;
input bool New_order_after_profit_buy = false;
input bool New_order_after_profit_sell = false;
input double TP = 600;
input double SL = 250;
input int Breakeven = 0;
input int Breakeven_distance = 0;
input int TS = 0;
input int TS_step = 0;
input int ID = 6060;

input string MACD = "Настройки MACD";
input int MACD_fast_ema_period = 5;
input int MACD_slow_ema_period = 10;
input int MACD_signal_period = 3;
input ENUM_APPLIED_PRICE MACD_applied_price = PRICE_CLOSE;

input string MACD_UP = "Настройки MACD на старшем таймфрейме";
input bool Use_MACD_on_upper_tf = false;
input ENUM_TIMEFRAMES MACD_upper_tf = PERIOD_M30;
input int MACD_fast_ema_period_2 = 34; //MACD_fast_ema_period
input int MACD_slow_ema_period_2 = 35; //MACD_slow_ema_period
input int MACD_signal_period_2 = 5; //MACD_signal_period
input ENUM_APPLIED_PRICE MACD_applied_price_2 = PRICE_CLOSE; //MACD_applied_price

input string MACD_TREND = "Настройки MACD для определения тренда";
input bool Use_MACD_for_trend = true;
input ENUM_TIMEFRAMES MACD_trend_tf = PERIOD_H4;
input int MACD_fast_ema_period_3 = 5; //MACD_fast_ema_period
input int MACD_slow_ema_period_3 = 10; //MACD_slow_ema_period
input int MACD_signal_period_3 = 3; //MACD_signal_period
input ENUM_APPLIED_PRICE MACD_applied_price_3 = PRICE_CLOSE; //MACD_applied_price

input string ORD = "Настройки открытия ордеров";
bool MarketExecution = true;
input int requote = 50;
input int number_try = 20;
input int time_period_try = 1;

string main_id;

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

void OnDeinit(const int reason)
  {

   if(UninitializeReason() == REASON_CHARTCLOSE || UninitializeReason() == REASON_REMOVE)
      GlobalVariablesDeleteAll(main_id);
  }

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

bool filter_by_trend(int type, string command)
  {
   bool res = false;
   if(!Use_MACD_for_trend)
      return(true);
   string now_direction = "";

   double macd_main_1 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_3,MACD_slow_ema_period_3,MACD_signal_period_3,MACD_applied_price_3,MODE_MAIN,1);
   double macd_main_2 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_3,MACD_slow_ema_period_3,MACD_signal_period_3,MACD_applied_price_3,MODE_MAIN,2);

   double macd_signal_1 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_3,MACD_slow_ema_period_3,MACD_signal_period_3,MACD_applied_price_3,MODE_SIGNAL,1);
   double macd_signal_2 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_3,MACD_slow_ema_period_3,MACD_signal_period_3,MACD_applied_price_3,MODE_SIGNAL,2);

   if(macd_signal_1 > 0 && macd_main_1 > macd_signal_1)
      now_direction = "trend";
   if(macd_signal_1 < 0 && macd_main_1 < macd_signal_1)
      now_direction = "trend";

   if(macd_signal_1 > 0 && macd_main_1 > 0 && macd_main_1 < macd_signal_1)
      now_direction = "correction";
   if(macd_signal_1 < 0 && macd_main_1 < 0 && macd_main_1 > macd_signal_1)
      now_direction = "correction";

   if(now_direction == command)
      res = true;

   return(res);
  }

bool signal_by_upper_tf(int type)
  {
   bool res = false;
   if(!Use_MACD_on_upper_tf)
      return(true);

   double macd_main_1 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_2,MACD_slow_ema_period_2,MACD_signal_period_2,MACD_applied_price_2,MODE_MAIN,1);
   double macd_main_2 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_2,MACD_slow_ema_period_2,MACD_signal_period_2,MACD_applied_price_2,MODE_MAIN,2);

   double macd_signal_1 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_2,MACD_slow_ema_period_2,MACD_signal_period_2,MACD_applied_price_2,MODE_SIGNAL,1);
   double macd_signal_2 = iMACD(NULL,MACD_upper_tf,MACD_fast_ema_period_2,MACD_slow_ema_period_2,MACD_signal_period_2,MACD_applied_price_2,MODE_SIGNAL,2);

   if(type == OP_BUY)
     {
      if(macd_signal_1 > 0 && macd_main_1 < macd_signal_1)
         res = true;
     }

   if(type == OP_SELL)
     {
      if(macd_signal_1 < 0 && macd_main_1 > macd_signal_1)
         res = true;
     }

   return(res);
  }

bool rules_by_open(int type)
  {
   bool res = false;

   if(One_order_per_direction)
      res = order_total(type) == 0?true:false;
   else
     {
      if(order_total(type) < Max_orders_per_direction)
         res = true;
      if(type == OP_BUY && New_order_after_profit_buy && order_profit(type) >= 0)
         res = true;
      if(type == OP_SELL && New_order_after_profit_sell && order_profit(type) >= 0)
         res = true;
     }

   return (res);
  }

double order_profit(int type_1 = -1, int type_2 = -1)
  {
   int i;
   double kol = 0;
   for(i = OrdersTotal() - 1; i >= 0; i --)
     {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderMagicNumber() == ID && (OrderType() == type_1 || OrderType() == type_2))
         kol+= OrderProfit() + OrderSwap() + OrderCommission();
      if(OrderMagicNumber() == ID && type_1 == -1 && type_2 == -1)
         kol+= OrderProfit() + OrderSwap() + OrderCommission();
     }
   return(kol);
  }

int order_total(int type_1 = -1, int type_2 = -1)
  {
   int i;
   int kol = 0;
   for(i = OrdersTotal() - 1; i >= 0; i --)
     {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderMagicNumber() == ID && (OrderType() == type_1 || OrderType() == type_2))
         kol++;
      if(OrderMagicNumber() == ID && type_1 == -1 && type_2 == -1)
         kol++;
     }
   return(kol);
  }

bool isNewBar()
  {
   static datetime BarTime;
   bool res = false;

   if(BarTime != Time[0])
     {
      BarTime = Time[0];
      res = true;
     }
   return(res);
  }

double check_lot(double &lo)
  {
   double l = MarketInfo(Symbol(),MODE_LOTSTEP);
   int ok = 0;
   while(l < 1)
     {
      l*=10;
      ok++;
     }
   if(lo < MarketInfo(Symbol(),MODE_MINLOT))
      lo = MarketInfo(Symbol(),MODE_MINLOT);
   if(lo > MarketInfo(Symbol(),MODE_MAXLOT))
      lo = MarketInfo(Symbol(),MODE_MAXLOT);
   return(NormalizeDo

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

Что вы получите после оплаты

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

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

Стоимость полного кода
1 059₽