Automate my trading 1.0

MQL5 专家

指定

#property copyright "Copyright 2024, Trade Smart Fx Tools"
#property link      "tradesmartfxtools.online"
#property version   "1.00"
#property strict

// Global Varibles
int MAGIC_NUMBER = 0907200406;
string labelName = "tradesmartfxtools.online";
string updatedLabelName = "updated_version_label";
string updatedLabelText = "Updated version available at tradesmartfxtools.online";
string labelText = "EA by tradesmartfxtools.online";
string buyProfitLabelName = "OverallBuyProfitLabel";
string sellProfitLabelName = "OverallSellProfitLabel";
int labelFontSize = 16;
int updatedLabelFontSize = 12;
color labelColor = Yellow;
color profitLabelColor = White;
color lossLabelColor = White;
int spaceFromBottom = 50;
color updatedLabelColor = White; 
int updatedSpaceFromBottom = 20;

input int fastMAPeriod = 10; // Period for fast MA
input int slowMAPeriod = 25; // Period for slow MA


//+------------------------------------------------------------------+
//| Labels                                                           |
//+------------------------------------------------------------------+

void createOrUpdateLabels(double buyProfit, double sellProfit)
  {
   if(ObjectFind(0, labelName) == -1)
     {
      ObjectCreate(0, labelName, OBJ_LABEL, 0, 0, 0);
     }
   ObjectSetInteger(0, labelName, OBJPROP_CORNER, CORNER_LEFT_LOWER);
   ObjectSetInteger(0, labelName, OBJPROP_XDISTANCE, 10);
   ObjectSetInteger(0, labelName, OBJPROP_YDISTANCE, spaceFromBottom);
   ObjectSetInteger(0, labelName, OBJPROP_COLOR, labelColor);
   ObjectSetInteger(0, labelName, OBJPROP_FONTSIZE, labelFontSize);
   ObjectSetInteger(0, labelName, OBJPROP_SELECTABLE, false);
   ObjectSetInteger(0, labelName, OBJPROP_SELECTED, false);
   ObjectSetString(0, labelName, OBJPROP_TEXT, labelText);


   if(ObjectFind(0, updatedLabelName) == -1)
     {
      ObjectCreate(0, updatedLabelName, OBJ_LABEL, 0, 0, 0);
     }
   ObjectSetInteger(0, updatedLabelName, OBJPROP_CORNER, CORNER_LEFT_LOWER);
   ObjectSetInteger(0, updatedLabelName, OBJPROP_XDISTANCE, 10);
   ObjectSetInteger(0, updatedLabelName, OBJPROP_YDISTANCE, updatedSpaceFromBottom);
   ObjectSetInteger(0, updatedLabelName, OBJPROP_COLOR, updatedLabelColor);
   ObjectSetInteger(0, updatedLabelName, OBJPROP_FONTSIZE, updatedLabelFontSize);
   ObjectSetString(0, updatedLabelName, OBJPROP_TEXT, updatedLabelText);

// Create or update the buy profit label
   string buyProfitText = "Overall Buy Profit: " + DoubleToString(buyProfit, 2);
   if(ObjectFind(0, buyProfitLabelName) == -1)
     {
      ObjectCreate(0, buyProfitLabelName, OBJ_LABEL, 0, 0, 0);
     }
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_CORNER, CORNER_LEFT_UPPER);
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_XDISTANCE, 20);
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_YDISTANCE, spaceFromBottom - 6); // Adjusted Y position
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_COLOR, profitLabelColor);
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_FONTSIZE, labelFontSize);
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_SELECTABLE, false);
   ObjectSetInteger(0, buyProfitLabelName, OBJPROP_SELECTED, false);
   ObjectSetString(0, buyProfitLabelName, OBJPROP_TEXT, buyProfitText);

// Create or update the sell profit label
   string sellProfitText = "Overall Sell Profit: " + DoubleToString(sellProfit, 2);
   if(ObjectFind(0, sellProfitLabelName) == -1)
     {
      ObjectCreate(0, sellProfitLabelName, OBJ_LABEL, 0, 0, 0);
     }
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_CORNER, CORNER_LEFT_UPPER);
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_XDISTANCE, 20);
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_YDISTANCE, spaceFromBottom - 36); // Adjusted Y position
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_COLOR, lossLabelColor);
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_FONTSIZE, labelFontSize);
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_SELECTABLE, false);
   ObjectSetInteger(0, sellProfitLabelName, OBJPROP_SELECTED, false);
   ObjectSetString(0, sellProfitLabelName, OBJPROP_TEXT, sellProfitText);



  }

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   createOrUpdateLabels(0.0, 0.0); // Initialize labels with 0 profit and trade counts

   return(INIT_SUCCEEDED);
  }
  
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+

void OnDeinit(const int reason)
  {
// Delete the main EA label
   if(ObjectFind(0, labelName) != -1)
      ObjectDelete(0, labelName);

// Delete the updated version label
   if(ObjectFind(0, updatedLabelName) != -1)
      ObjectDelete(0, updatedLabelName);

// Delete the buy profit label
   if(ObjectFind(0, buyProfitLabelName) != -1)
      ObjectDelete(0, buyProfitLabelName);

// Delete the sell profit label
   if(ObjectFind(0, sellProfitLabelName) != -1)
      ObjectDelete(0, sellProfitLabelName);

   Print("All labels have been removed.");
  }


//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

   double totalBuyProfit = 0.0;
   double totalSellProfit = 0.0;


// Calculate total buy and sell profits and count trades
   for(int i = OrdersTotal() - 1; i >= 0; i--)
     {
      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == _Symbol)
        {
         if(OrderType() == OP_BUY)
           {
            totalBuyProfit += OrderProfit();

           }
         else
            if(OrderType() == OP_SELL)
              {
               totalSellProfit += OrderProfit();

              }
        }
     }

   createOrUpdateLabels(totalBuyProfit, totalSellProfit);

   CloseProfitableTradesOnMACrossover();



  }


//+------------------------------------------------------------------+
//| Close Profitable Trades On MA Crossover                          |
//+------------------------------------------------------------------+
void CloseProfitableTradesOnMACrossover()
  {
   double fastMA = iMA(NULL, 0, fastMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
   double slowMA = iMA(NULL, 0, slowMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
   double fastMA_prev = iMA(NULL, 0, fastMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
   double slowMA_prev = iMA(NULL, 0, slowMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);

// Check for crossover
   bool bullishCrossover = fastMA_prev < slowMA_prev && fastMA > slowMA;
   bool bearishCrossover = fastMA_prev > slowMA_prev && fastMA < slowMA;

   if(bullishCrossover || bearishCrossover)
     {

      // Loop through all open trades

      int totalOrders = OrdersTotal();
      if(totalOrders == 0)
        {
         Print("No open orders found.");
         return;
        }
      for(int i = totalOrders - 1; i >= 0; i--)
        {
         if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
           {
            // Check if the trade is profitable
            double profit = OrderProfit();
            if(profit >= 0)
              {
               // Attempt to close the order
               bool closed = false;
               if(OrderType() == OP_BUY)
                 {
                  closed = OrderClose(OrderTicket(), OrderLots(), Bid, 2, clrRed);
                  if(closed)
                     Print("Closed profitable Buy order ", OrderTicket(), " with profit: ", profit);
                  else
                     Print("Error closing Buy order ", OrderTicket(), ": Error code ", GetLastError());
                 }
               else
                  if(OrderType() == OP_SELL)
                    {
                     closed = OrderClose(OrderTicket(), OrderLots(), Ask, 2, clrRed);
                     if(closed)
                        Print("Closed profitable Sell order ", OrderTicket(), " with profit: ", profit);
                     else
                        Print("Error closing Sell order ", OrderTicket(), ": Error code ", GetLastError());
                    }
              }
            else
              {
               Print("Order ", OrderTicket(), " is not profitable, skipping.");
              }
           }
         else
           {
            Print("Error selecting order ", i, ": Error code ", GetLastError());
           }
        }
     }
  }


//+------------------------------------------------------------------+

反馈

1
开发者 1
等级
(237)
项目
298
28%
仲裁
33
24% / 61%
逾期
9
3%
已载入
2
开发者 2
等级
(151)
项目
188
57%
仲裁
10
80% / 0%
逾期
0
空闲
发布者: 1 代码
3
开发者 3
等级
(442)
项目
570
37%
仲裁
106
39% / 33%
逾期
17
3%
空闲
4
开发者 4
等级
(3)
项目
2
0%
仲裁
1
0% / 0%
逾期
0
空闲
5
开发者 5
等级
(268)
项目
396
27%
仲裁
38
39% / 50%
逾期
1
0%
空闲
6
开发者 6
等级
(539)
项目
619
33%
仲裁
35
37% / 49%
逾期
11
2%
繁忙
7
开发者 7
等级
(246)
项目
253
30%
仲裁
0
逾期
3
1%
空闲
发布者: 2 代码
8
开发者 8
等级
(294)
项目
469
39%
仲裁
102
40% / 24%
逾期
77
16%
已载入
发布者: 2 代码
相似订单
BencookFX EA 10000+ USD
THE STRATEAGY OF BECOOK FX IS LITERALLY A CODE WHICH IT DEAD TIME ZONE ON ICT AND RETAIL TRADER COMBINE WHICH IS A TEST FOR THOSE WHO WANT TO TRADE AND ACT LIKE
Im looking for an experience developer that can help develop an EA based on 3-4 strategies below into 1 EA itself It should not use grid or martingale. Symbol : XAUUSD All trades opened by the EA will have a predefined Stop Loss and Take Profit . Strategy 1 – High Timeframe Trend Reversal (Bottom Detection) This strategy focuses on identifying major market bottoms by tracking extreme oversold conditions on higher
Hi, I’m looking for an experienced Forex developer with proven, long-term market experience to partner with me in building a professional trading bot for my EA business. Please note: I am not looking to provide the trading strategy or concept. I expect you to propose the strategy, justify it, and fully develop the EA based on the requirements below. Strategy Requirements:. Day trading approach: 1–3 trades per day
Hallo zusammen, für einen sehr aufwändigen Expert Advisor in MQL5 suche ich einen (oder mehrere) talentierte und erfahrene Programmierer, die bereits mehr als +5 Jahre einschlägige Programmiererfahrung in MQL5 OOP haben. Darüber hinaus suche ich Experten für Maschinelles Lernen und Neuronale Netzwerke, denn ich möchte den Expert Advisor um Bibliotheken mit selbstständigen Lernen und Anpassen kontinuierlich erweitern
Product Name: Smart Profit EA Price: $600 (One-time) 📩 Contact & Support Interested buyers can contact me directly on Telegram: @SACHINKOULAGE for support, setup guidance, and pre-sale questions. 📌 Overview Smart Profit EA is a fully automated trading Expert Advisor designed to deliver stable and consistent monthly profits with controlled risk. This EA has been tested on a $500 trading account , where it is capable
Scalping ea mt5 30 - 50 USD
PHẦN 1: TIẾNG ANH (For MQL5 Freelance) Title: I need a Pro Dev for Scalping EA: I provide STRICT Money Management, YOU provide the Strategy Description: I have a strict Capital & Risk Management Framework. The Entry Strategy is UP TO YOU (Must be "King Scalping" / Multi-Timeframe style). 1. STRATEGY (YOUR JOB) * Requirement: You decide the entry logic. It must be a High Probability and High Volume scalping strategy
I’m looking to purchase an MT5 Expert Advisor that focuses on swing trades with large-move targets (e.g., 100+ pips profit per trade ). Requirements ✅ Must work on MetaTrader 5 (MT5) ✅ Can trade any Forex pair (multi-symbol), GOLD preference ✅ Designed for swing trading style (medium-term — not scalping) ✅ Targets 100+ pips per trade / large market moves ✅ Built-in risk management (stop loss, take profit, breakeven
Evil trader 30+ USD
Trading bot using resistance for is strategy with no taking to much of risk on the lots size making it the best trading tp for me to use and also no when to trade and when not to
I have an expert advisor (MQL5) that works professionally on all timeframes. This is a test on a 5-minute timeframe, from $10,000 to $614,195.70, from the beginning of 2025 to the beginning of 2026 on the Dow Jones
1441 30+ USD
444fwefwefw jlklklklklklklklklkeaNRFNEWM EWQJEWQIOREJEWQKLFDNMKLFD.MDW/LFDK.MEWFDLK;EMFWEKLMFWELKFREWNMFNDM,VSDV/S.DAFLMWEO;RWEJRPWOEJWE09PUJR9O EJ WKEWMK F FMKDSMKF SDEWJWJ [Q\ /QLDKNQNDQPIUHQD.Q,DMASDOAIFDA,M DFA AAS,KFDJNLOFD NOIFDJNFDAS NKNLOASJOFIKJD ASOIJFISFNKSNF SFSNOIWWQJ-0I[PKEM DAI-0IK-0DQMDQ NDACAI-0 I- EKQ;LDN0912KDMMOIKM Cdjoiasd f09wilf d qkdfokawsd-09fdkdadsomfasdlkkf-0 q[pkkd-0]q2kda\fld

项目信息

预算
40+ USD