支持中心 帮助文档 联系我们
📱 微信: 18391752892 | 💬 QQ: 3313198376 | ✈️ Telegram | 📧 fishfx123@gmail.com
EURUSD 1.0856 +0.12% GBPUSD 1.2678 +0.08% USDJPY 149.23 -0.15% XAUUSD 2034.56 +0.34% EURUSD 1.0856 +0.12% GBPUSD 1.2678 +0.08% USDJPY 149.23 -0.15% XAUUSD 2034.56 +0.34%

Ut Bot Indicator

👤 作者: Menaka Sachin Thorat

4.5 分

¥0.00

📌 版本: v1.0
📥 下载: 0
⭐ 评分: 4.5

📝 产品详情

Ut Bot Indicator

作者Menaka Sachin Thorat
版本v1.0
激活数0

Evolutionize Your Trading with the UT Alert Bot Indicator for MQL4

The UT Alert Bot Indicator is your ultimate trading companion, meticulously designed to give you an edge in the fast-paced world of financial markets. Powered by the renowned UT system, this cutting-edge tool combines advanced analytics, real-time alerts, and customizable features to ensure you never miss a profitable opportunity. Whether you’re trading forex, stocks, indices, or commodities, the UT Alert Bot Indicator is your key to smarter, faster, and more precise trading decisions.

Here is the source code of a simple Expert Advisor operating based on signals from Ut Bot Alert.

#property copyright "This EA is only education purpose only use it ur own risk"
#property link      "https://sites.google.com/view/automationfx/home"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
// Expert iniputs                                                    |
//+------------------------------------------------------------------+
input string             EA_Setting              =  "";                   // General settings
input int                magic_number            = 1234;                 // Magic number for trade identification
input double             fixed_lot_size          = 0.01;                 // Fixed lot size
input double             StopLoss                = 0;                    // Stop loss level (in pips)
input double             TakeProfit              = 0;                   // Take profit level (in pips)
input double             LotMultiplier = 2.0; // Multiplier for martingale strategy


string Name_Indicator       = "Market/UT Bot Indicator.ex4";  // Name of the custom indicator
int bufferToBuy2 = 0;                      // Buffer index for buy signals
int bufferToSell2 = 1;                     // Buffer index for sell signals
double current_lot_size;                   // Current lot size
int LastProf = 0;                          // 1 = profit, -1 = loss, 0 = no history


// Enum to represent candle indices
enum candle
  {
   curr = -1,  // Current candle
   prev = 0    // Previous closed candle
  };

// Indicator settings
input string Indicator = "== Market/UT Bot Indicator.ex4 ==";    // Indicator title
static input string _Properties_ = "Automationfx";  // Expert properties
input double         Key_value          =  2;         // Key value for indicator calculation
input double         atrPeriods         =  14;       // ATR periods for indicator
input bool           h                  = false;     // Use Heiken Ashi candles for signals
int                  s                  = prev;     // Show arrows on previous candle
int                  p                  = 20;                         // Arrow position (in points)
input int            b                  = 10;                 // Candle period for calculations
string T_0 = "== Draw Trade ==";    // Trade drawing title
input bool          drawTradeON         = false;

//+------------------------------------------------------------------+
//|  get indicator                                                                |
//+------------------------------------------------------------------+
double UT_Bot(int buffer, int _candle)
  {
// Call the custom indicator and return its value
   return iCustom(NULL, 0, "Market/UT Bot Indicator.ex4",Indicator, Key_value, atrPeriods, h, s, p, b, T_0, drawTradeON, buffer, _candle);
  }


//+------------------------------------------------------------------+
// Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ChartSetInteger(0, CHART_SHOW_GRID, false);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| for calculation buy                                 |
//+------------------------------------------------------------------+
int BuyCount()
  {
   int counter=0;
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i, SELECT_BY_POS)==false)
         continue;
      if(OrderSymbol()!=_Symbol)
         continue;
      if(OrderMagicNumber()!=magic_number)
         continue;
      if(OrderType()==OP_BUY)
         counter++;
     }
   return counter;
  }

//+------------------------------------------------------------------+
//| for calculation sell                                                                 |
//+------------------------------------------------------------------+
int SellCount()
  {
   int counter=0;
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i, SELECT_BY_POS)==false)
         continue;
      if(OrderSymbol()!=_Symbol)
         continue;
      if(OrderMagicNumber()!=magic_number)
         continue;
      if(OrderType()==OP_SELL)
         counter++;
     }
   return counter;
  }



//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
// Check if a new bar has formed
   if(!isNewBar())
      return;
// Buy condition
   bool buy_condition = true;
   buy_condition &= (BuyCount() == 0);
   buy_condition &= (UT_Bot(0, 1) != EMPTY_VALUE); // Ensure valid check

   if(buy_condition)
     {
      CloseSell();
      Buy();
     }
// Sell condition
   bool sell_condition = true;
   sell_condition &= (SellCount() == 0);
   sell_condition &= (UT_Bot(1, 1) != EMPTY_VALUE); // Ensure valid check

   if(sell_condition)
     {
      CloseBuy();
      Sell();
     }

  }

// Function to calculate lot size based on the last trade
void Lot()
  {
// Analyze the last order in history
   if(OrderSelect(OrdersHistoryTotal() - 1, SELECT_BY_POS, MODE_HISTORY))
     {
      if(OrderSymbol() == _Symbol && OrderMagicNumber() == magic_number)
        {
         if(OrderProfit() > 0)
           {
            LastProf = 1;                   // Last trade was profitable
            current_lot_size = fixed_lot_size; // Reset to fixed lot size
           }
         else
           {
            LastProf = -1;                  // Last trade was a loss
            current_lot_size = NormalizeDouble(current_lot_size * LotMultiplier, 2);
           }
        }
     }
   else
     {
      // No previous trades, use the fixed lot size
      LastProf = 0;
      current_lot_size = fixed_lot_size;
     }
  }



datetime timer=NULL;
bool isNewBar()
  {
   datetime candle_start_time= (int)(TimeCurrent()/(PeriodSeconds()))*PeriodSeconds();
   if(timer==NULL) {}
   else
      if(timer==candle_start_time)
         return false;
   timer=candle_start_time;
   return true;
  }

//+------------------------------------------------------------------+
//|  open buy trades                                                                |
//+------------------------------------------------------------------+
void Buy()
  {
   Lot();
   double StopLossLevel;
   double TakeProfitLevel;
// Calculate the stop loss and take profit levels based on input values
   if(StopLoss>0)
      StopLossLevel=Bid-StopLoss*Point;
   else
      StopLossLevel=0.0;
   if(TakeProfit>0)
      TakeProfitLevel=Ask+TakeProfit*Point;
   else
      TakeProfitLevel=0.0;


   if(OrderSend(_Symbol, OP_BUY, current_lot_size, Ask, 3, StopLossLevel,TakeProfitLevel, NULL, magic_number, 0, clrNONE) == -1)
     {
      Print("Error Executing Buy Order: ", GetLastError());
     }
  }

//+------------------------------------------------------------------+
//|  open sell trades                                                                |
//+------------------------------------------------------------------+
void Sell()
  {
   Lot();
   double StopLossLevel1;
   double TakeProfitLevel2;
// Calculate the stop loss and take profit levels based on input values
   if(StopLoss>0)
      StopLossLevel1=Ask+StopLoss*Point;
   else
      StopLossLevel1=0.0;
   if(TakeProfit>0)
      TakeProfitLevel2=Bid-TakeProfit*Point;
   else
      TakeProfitLevel2=0.0;


   if(OrderSend(_Symbol, OP_SELL, current_lot_size, Bid, 3, StopLossLevel1,TakeProfitLevel2, NULL, magic_number, 0, clrNONE) == -1)
     {
      Print("Error Executing Sell Order: ", GetLastError());
     }
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseBuy()
  {
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i, SELECT_BY_POS)==false)
         continue;
      if(OrderSymbol()!=_Symbol)
         continue;
      if(OrderMagicNumber()!=magic_number)
         continue;
      if(OrderType()==OP_BUY)
         if(OrderClose(OrderTicket(), OrderLots(), Bid, 3, clrNONE)==false)
           {
            Print("Error Closing Position: ", GetLastError());
           }
     }
  }

//+------------------------------------------------------------------+
//|  close all positions currunly not use                                                                |
//+------------------------------------------------------------------+
void CloseSell()
  {
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i, SELECT_BY_POS)==false)
         continue;
      if(OrderSymbol()!=_Symbol)
         continue;
      if(OrderMagicNumber()!=magic_number)
         continue;
      if(OrderType()==OP_SELL)
         if(OrderClose(OrderTicket(), OrderLots(), Ask, 3, clrNONE)==false)
           {
            Print("Error Closing Position: ", GetLastError());
           }
     }
  }
//+------------------------------------------------------------------+ 


安全须知

本产品仅通过 MQL5.com 官方渠道获取。其他渠道版本可能缺少完整功能和技术支持。

EA 配置

交易品种XAUUSD
时间框架H1 (推荐)
推荐经纪商IC Markets, IC Trading
最低存款$300 / 0.01手

📸 截图预览