论坛全局菜单下方 -  icmarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - TICKMILL 285X70
  • 1
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
前往
共 311 条
一路成长
注册时间2014-01-08
[灌水]寻找正确的交易
发表于:2026-02-01 12:37只看该作者
305楼 电梯直达
电梯直达

加油

个性签名

韬客社区www.talkfx.co

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
QLG
注册时间2017-10-29
楼主发表于:2026-02-20 13:59只看该作者
306楼

新年快乐!马到成功!

淘米
注册时间2011-01-06
发表于:2026-02-21 01:03只看该作者
307楼

新年快乐今年一起赚钱发财

QLG
注册时间2017-10-29
楼主发表于:2026-03-03 22:12只看该作者
308楼

202602 偷懒了

https://man.talkfx.co/upload/upload/file/2026/03-04/17725759176942139154211.png

满仓暴赚
注册时间2011-02-06
QLG
注册时间2017-10-29
楼主发表于:2026-04-01 14:27只看该作者
310楼

2026年3月,当牛马的日子生活比较有规律

https://man.talkfx.co/upload/upload/file/2026/04-01/17750535927871030541240.png

挨过打
注册时间2013-03-08
发表于:2026-04-02 00:42只看该作者
311楼

这个是盈利吗

QLG
注册时间2017-10-29
楼主发表于:2026-04-02 01:19只看该作者
312楼

每天走8000步,低于6000则为不及格

QLG
注册时间2017-10-29
楼主发表于:2026-04-02 23:11只看该作者
313楼

有人提出要一个MT5账号的净值监控软件,需求只是一句话,那我也只是用一句话给DS写,代码如下:

//+------------------------------------------------------------------+
//|                                          MonitorNetWorthEA.mq5  |
//|                                    Copyright 2023, Your Name     |
//|                                             |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, Your Name"
#property link      ""
#property version   "1.00"
#property strict

// 输入参数
input double   ThresholdValue     = 10000.0;      // 净值阈值
input bool     AlertWhenAbove     = true;         // 高于阈值时报警
input bool     AlertWhenBelow     = true;         // 低于阈值时报警
input bool     CloseAllWhenAbove  = false;        // 高于阈值时平仓所有订单
input bool     CloseAllWhenBelow  = false;        // 低于阈值时平仓所有订单
input int      CheckInterval      = 60;           // 检查间隔(秒)
input string   AlertMessage       = "账户净值已达阈值"; // 报警消息
input bool     EnableNotification = true;         // 发送推送通知
input bool     SendEmailAlert     = false;        // 发送邮件
input bool     LogToFile          = true;         // 记录到文件

// 全局变量
datetime lastCheckTime = 0;
string   logFileName = "NetWorthMonitor.csv";
bool     lastAboveThreshold = false;
bool     lastBelowThreshold = false;

//+------------------------------------------------------------------+
//| 专家初始化函数                                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   // 创建日志文件
   if(LogToFile)
   {
      int handle = FileOpen(logFileName, FILE_WRITE|FILE_CSV|FILE_READ, ",");
      if(handle != INVALID_HANDLE)
      {
         FileWrite(handle, "时间", "净值", "状态", "账户余额", "浮动盈亏");
         FileClose(handle);
      }
   }
   
   // 首次检查
   lastCheckTime = TimeCurrent();
   CheckNetWorth();
   
   Print("净值监控EA已启动,阈值: ", ThresholdValue, ", 检查间隔: ", CheckInterval, "秒");
   
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| 专家反初始化函数                                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   Print("净值监控EA已停止,原因代码: ", reason);
}

//+------------------------------------------------------------------+
//| 专家主函数                                                       |
//+------------------------------------------------------------------+
void OnTick()
{
   // 按间隔检查
   if(TimeCurrent() - lastCheckTime >= CheckInterval)
   {
      lastCheckTime = TimeCurrent();
      CheckNetWorth();
   }
}

//+------------------------------------------------------------------+
//| 检查账户净值                                                     |
//+------------------------------------------------------------------+
void CheckNetWorth()
{
   double equity = AccountInfoDouble(ACCOUNT_EQUITY);
   double balance = AccountInfoDouble(ACCOUNT_BALANCE);
   double floatingProfit = equity - balance;
   bool currentAboveThreshold = (equity > ThresholdValue);
   bool currentBelowThreshold = (equity < ThresholdValue);
   
   // 记录日志
   if(LogToFile)
   {
      LogEquity(equity, currentAboveThreshold, balance, floatingProfit);
   }
   
   // 检查阈值条件并执行相应操作
   if(currentAboveThreshold)
   {
      // 从低于阈值变为高于阈值时触发报警
      if(AlertWhenAbove && !lastAboveThreshold)
      {
         string msg = AlertMessage + " | 净值: " + DoubleToString(equity, 2) + 
                      " | 高于阈值: " + DoubleToString(ThresholdValue, 2);
         SendAlerts(msg);
      }
      
      // 高于阈值时平仓
      if(CloseAllWhenAbove && !lastAboveThreshold)
      {
         CloseAllPositions("净值高于阈值");
      }
   }
   else if(currentBelowThreshold)
   {
      // 从高于阈值变为低于阈值时触发报警
      if(AlertWhenBelow && !lastBelowThreshold)
      {
         string msg = AlertMessage + " | 净值: " + DoubleToString(equity, 2) + 
                      " | 低于阈值: " + DoubleToString(ThresholdValue, 2);
         SendAlerts(msg);
      }
      
      // 低于阈值时平仓
      if(CloseAllWhenBelow && !lastBelowThreshold)
      {
         CloseAllPositions("净值低于阈值");
      }
   }
   
   // 更新状态
   lastAboveThreshold = currentAboveThreshold;
   lastBelowThreshold = currentBelowThreshold;
}

//+------------------------------------------------------------------+
//| 发送警报(弹窗/通知/邮件)                                         |
//+------------------------------------------------------------------+
void SendAlerts(string message)
{
   // 弹窗警报
   Alert(message);
   
   // 推送通知到手机
   if(EnableNotification)
   {
      SendNotification(message);
   }
   
   // 发送邮件
   if(SendEmailAlert)
   {
      SendMail("账户净值警报", message);
   }
   
   Print("警报已发送: ", message);
}

//+------------------------------------------------------------------+
//| 平仓所有持仓                                                     |
//+------------------------------------------------------------------+
void CloseAllPositions(string reason)
{
   int total = PositionsTotal();
   int closed = 0;
   
   for(int i = total - 1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);
      if(ticket > 0)
      {
         if(PositionSelectByTicket(ticket))
         {
            // 准备平仓请求
            MqlTradeRequest request = {};
            MqlTradeResult result = {};
            
            request.action = TRADE_ACTION_DEAL;
            request.symbol = PositionGetString(POSITION_SYMBOL);
            request.volume = PositionGetDouble(POSITION_VOLUME);
            request.deviation = 10;
            request.magic = ExpertMagic();
            request.comment = "平仓(" + reason + ")";
            
            // 确定平仓方向
            long positionType = PositionGetInteger(POSITION_TYPE);
            if(positionType == POSITION_TYPE_BUY)
            {
               request.type = ORDER_TYPE_SELL;
               request.price = SymbolInfoDouble(request.symbol, SYMBOL_BID);
            }
            else if(positionType == POSITION_TYPE_SELL)
            {
               request.type = ORDER_TYPE_BUY;
               request.price = SymbolInfoDouble(request.symbol, SYMBOL_ASK);
            }
            
            request.position = ticket;
            
            // 执行平仓
            if(OrderSend(request, result))
            {
               if(result.retcode == TRADE_RETCODE_DONE)
               {
                  closed++;
                  Print("已平仓: ", request.symbol, " 订单号: ", ticket);
               }
               else
               {
                  Print("平仓失败: ", request.symbol, " 错误码: ", result.retcode, " 说明: ", result.comment);
               }
            }
         }
      }
   }
   
   if(closed > 0)
   {
      string msg = "已平仓 " + IntegerToString(closed) + " 个订单,原因: " + reason;
      SendAlerts(msg);
   }
}

//+------------------------------------------------------------------+
//| 记录净值日志                                                     |
//+------------------------------------------------------------------+
void LogEquity(double equity, bool isAboveThreshold, double balance, double floatingProfit)
{
   int handle = FileOpen(logFileName, FILE_WRITE|FILE_CSV|FILE_READ, ",");
   if(handle != INVALID_HANDLE)
   {
      // 移动到文件末尾
      FileSeek(handle, 0, SEEK_END);
      
      string status = isAboveThreshold ? "高于阈值" : "低于阈值";
      string timeStr = TimeToString(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS);
      
      FileWrite(handle, timeStr, 
                DoubleToString(equity, 2),
                status,
                DoubleToString(balance, 2),
                DoubleToString(floatingProfit, 2));
      FileClose(handle);
   }
   else
   {
      Print("无法打开日志文件: ", logFileName, " 错误: ", GetLastError());
   }
}

//+------------------------------------------------------------------+
//| 获取EA魔术数                                                     |
//+------------------------------------------------------------------+
int ExpertMagic()
{
   // 使用EA名称的哈希值作为魔术数
   string name = "MonitorNetWorthEA";
   int magic = 0;
   for(int i = 0; i < StringLen(name); i++)
      magic += (int)StringGetCharacter(name, i);
   return magic;
}

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

能实现这样的功能:

https://man.talkfx.co/upload/upload/file/2026/04-03/177517146783990527115.png

QLG
注册时间2017-10-29
楼主发表于:2026-04-02 23:17只看该作者
314楼

MT5-净值监控EA 1.0

https://man.talkfx.co/upload/upload/file/2026/04-03/1775171817646209321624.png

  • 1
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
前往
共 311 条

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]