当前位置: 首页 > news >正文

【漆学军】MT5几个重要类库的使用例子

MT5编程,有两种方式,一种是函数式编程,一种是面向对象编程。

面向对象编程,会让我们编写代码变得非常简单。

面向对象编程,主要是要熟悉4个类库。

#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\OrderInfo.mqh>

其中 

PositionInfo 是持仓单信息 
OrderInfo    是挂单信息
SymbolInfo  是品种信息
Trade    是交易类库

使用之前,需要定义各种对象的实例

CPositionInfo  m_position;                   // trade position object
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object
COrderInfo     m_order;                      // pending orders object

交易之前,在初始化函数里面,要指定一些相应的属性

//---m_trade.SetExpertMagicNumber(m_magic);  //指定魔术号
//---if(IsFillingTypeAllowed(SYMBOL_FILLING_FOK))m_trade.SetTypeFilling(ORDER_FILLING_FOK);elseif(IsFillingTypeAllowed(SYMBOL_FILLING_IOC))m_trade.SetTypeFilling(ORDER_FILLING_IOC);elsem_trade.SetTypeFilling(ORDER_FILLING_RETURN);
//---m_trade.SetAsyncMode(true);            //指定异步模式,有了这条,可瞬时下单上万单m_trade.SetDeviationInPoints(m_slippage);

下面就不一一介绍了,我给出一个挂单EA的全部源码,可直接下载下去好好学习。

//+------------------------------------------------------------------+
//|                       EA Stop Order(barabashkakvn's edition).mq5 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Хлыстов Владимир"
#property link      "cmillion@narod.ru"
#property version   "2.00"
#property description " Advisor opens a grid of stop orders"
#property description "    When the specified profit level is reached,"
#property description "       it closes all positions and deletes all pending orders"
//---
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\OrderInfo.mqh>
CPositionInfo  m_position;                   // trade position object
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object
COrderInfo     m_order;                      // pending orders object
//--- input parameters
input double   InpProfitClose    = 5;        // Profit purpose (in money)
input bool     InpBuyStop        = true;     // Use Buy stop
input bool     InpSellStop       = true;     // Use Sell stop
input int      InpMaxOrders      = 10;       // Maximum pending orders
input ushort   InpStopLoss       = 0;        // StopLoss ("0" -> off)
input ushort   InpTakeProfit     = 0;        // TakeProfit ("0" -> off)
input ushort   InpDistance       = 100;      // Distance from current price
input double   InpLots           = 0.1;      // Lots
input double   InpLotRatio       = 1.5;      // Lot Ratio
input ulong    m_magic=72994760;             // magic number
//---
ulong          m_slippage=10;                // slippagedouble         ExtStopLoss=0.0;
double         ExtTakeProfit=0.0;
//---
//---
bool           m_bln_close_all=false;        // "true" -> you must close all positions
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit(){if(InpLotRatio<=0.0){string text=__FUNCTION__+", ERROR: "+"The parameter \"Lot Ratio\" can not be less than or equal to zero";Print(text);Alert(text);return(INIT_PARAMETERS_INCORRECT);}
//---if(!m_symbol.Name(Symbol())) // sets symbol namereturn(INIT_FAILED);RefreshRates();string err_text="";if(!CheckVolumeValue(InpLots,err_text)){Print(__FUNCTION__,", ERROR: ",err_text);return(INIT_PARAMETERS_INCORRECT);}
//---m_trade.SetExpertMagicNumber(m_magic);
//---if(IsFillingTypeAllowed(SYMBOL_FILLING_FOK))m_trade.SetTypeFilling(ORDER_FILLING_FOK);elseif(IsFillingTypeAllowed(SYMBOL_FILLING_IOC))m_trade.SetTypeFilling(ORDER_FILLING_IOC);elsem_trade.SetTypeFilling(ORDER_FILLING_RETURN);
//---m_trade.SetAsyncMode(true);m_trade.SetDeviationInPoints(m_slippage);
//---ExtStopLoss=InpStopLoss*m_symbol.Point();ExtTakeProfit=InpTakeProfit*m_symbol.Point();
//---m_bln_close_all=false;                    // "true" -> you must close all positions
//---return(INIT_SUCCEEDED);}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason){
//---}double Ask,Bid;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int RefreshRates0(string symbol=""){if(symbol=="")symbol=_Symbol;MqlTick last_tick;SymbolInfoTick(symbol,last_tick);double Bid0=last_tick.bid;SymbolInfoTick(_Symbol,last_tick);Bid=last_tick.bid;Ask=last_tick.ask;if(Bid0==0)Print("刷新数据失败,请检查MT5是不是掉线了,或者打开对应图表加速数据图表更新 "+symbol);if((Bid0)==0)return(0);elsereturn(1);}input bool 启用新增功能=1;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void funx(){if(启用新增功能==false)return;if(A_Mq4_FirstOpen_Price(0)>0)if(Bid>A_Mq4_FirstOpen_Price(0))if(Countlots(1)>Countlots(0))m_trade.Buy(Countlots(1)-Countlots(0), m_symbol.Name(), Ask, 0.0, 0.0,  "_sc");if(Bid<A_Mq4_FirstOpen_Price(1))if(Countlots(1)<Countlots(0))m_trade.Sell(Countlots(0)-Countlots(1), m_symbol.Name(), Bid, 0.0, 0.0,  "_sc");}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick(){RefreshRates0();funx();if(m_bln_close_all){CloseAllPositions();DeleteAllOrders();if(CalculateAllPositions()==0.0 && CalculateAllPendingOrders()==0.0)m_bln_close_all=false;}
//---double Profit=0.0;for(int i=PositionsTotal()-1;i>=0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)Profit+=m_position.Commission()+m_position.Swap()+m_position.Profit();
//---if(Profit>=InpProfitClose) // close all{m_bln_close_all=true;return;}
//---if(CalculateAllPendingOrders()!=0){MoveOrder();return;}
//---if(!RefreshRates())return;int StopsLevel=m_symbol.StopsLevel();if(StopsLevel==0)StopsLevel=m_symbol.Spread()*3;for(int i=1; i<=InpMaxOrders; i++){if(InpDistance*i>StopsLevel){double Lot=(i==1)?InpLots:LotCheck(InpLots*(double)(i-1)*InpLotRatio);if(Lot!=0.0){if(InpBuyStop){double Price=m_symbol.NormalizePrice(m_symbol.Ask()+(double)InpDistance*(double)i*m_symbol.Point());double sl=(InpStopLoss==0)?0.0:m_symbol.NormalizePrice(Price-ExtStopLoss);double tp=(InpTakeProfit==0)?0.0:m_symbol.NormalizePrice(Price+ExtTakeProfit);m_trade.BuyStop(Lot,Price,m_symbol.Name(),sl,tp);}if(InpSellStop){double Price=m_symbol.NormalizePrice(m_symbol.Bid()-(double)InpDistance*(double)i*m_symbol.Point());double sl=(InpStopLoss==0)?0.0:m_symbol.NormalizePrice(Price+ExtStopLoss);double tp=(InpTakeProfit==0)?0.0:m_symbol.NormalizePrice(Price-ExtTakeProfit);m_trade.SellStop(Lot,Price,m_symbol.Name(),sl,tp);}}}}
//---}
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,const MqlTradeRequest &request,const MqlTradeResult &result){
//---}
//+------------------------------------------------------------------+
//| Refreshes the symbol quotes data                                 |
//+------------------------------------------------------------------+
bool RefreshRates(void){
//--- refresh ratesif(!m_symbol.RefreshRates()){Print("RefreshRates error");return(false);}
//--- protection against the return value of "zero"if(m_symbol.Ask()==0 || m_symbol.Bid()==0)return(false);
//---return(true);}
//+------------------------------------------------------------------+
//| Check the correctness of the order volume                        |
//+------------------------------------------------------------------+
bool CheckVolumeValue(double volume,string &error_description){
//--- minimal allowed volume for trade operationsdouble min_volume=m_symbol.LotsMin();if(volume<min_volume){error_description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);return(false);}
//--- maximal allowed volume of trade operationsdouble max_volume=m_symbol.LotsMax();if(volume>max_volume){error_description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);return(false);}
//--- get minimal step of volume changingdouble volume_step=m_symbol.LotsStep();int ratio=(int)MathRound(volume/volume_step);if(MathAbs(ratio*volume_step-volume)>0.1){error_description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",volume_step,ratio*volume_step);return(false);}error_description="Correct volume value";return(true);}
//+------------------------------------------------------------------+
//| Checks if the specified filling mode is allowed                  |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed(int fill_type){
//--- Obtain the value of the property that describes allowed filling modesint filling=m_symbol.TradeFillFlags();
//--- Return true, if mode fill_type is allowedreturn((filling & fill_type)==fill_type);}
//+------------------------------------------------------------------+
//| Lot Check                                                        |
//+------------------------------------------------------------------+
double LotCheck(double lots){
//--- calculate maximum volumedouble volume=NormalizeDouble(lots,2);double stepvol=m_symbol.LotsStep();if(stepvol>0.0)volume=stepvol*MathFloor(volume/stepvol);
//---double minvol=m_symbol.LotsMin();if(volume<minvol)volume=minvol;
//---double maxvol=m_symbol.LotsMax();if(volume>maxvol)volume=maxvol;return(volume);}
//+------------------------------------------------------------------+
//| Close all positions                                              |
//+------------------------------------------------------------------+
void CloseAllPositions(){for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current positionsif(m_position.SelectByIndex(i))     // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol}
//+------------------------------------------------------------------+
//| Calculate all positions                                          |
//+------------------------------------------------------------------+
int CalculateAllPositions(){int total=0;for(int i=PositionsTotal()-1;i>=0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)total++;
//---return(total);}//+------------------------------------------------------------------+
int CountT(ENUM_POSITION_TYPE i0){int total=0;for(int i=PositionsTotal()-1;i>=0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)if(m_position.PositionType()==i0)total++;
//---return(total);}//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Countlots(ENUM_POSITION_TYPE i0){double total=0;for(int i=PositionsTotal()-1;i>=0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)if(m_position.PositionType()==i0)total=total+m_position.Volume();
//---return(total);}//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double  A_Mq4_FirstOpen_Price(ENUM_POSITION_TYPE Type){double A_Mq4_FirstOpen_Price=0;for(int i=0; i<PositionsTotal(); i++)// for(int i=PositionsTotal()-1;i>=0;i--)if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)if(m_position.PositionType()==Type){A_Mq4_FirstOpen_Price=m_position.PriceOpen();break;}return(A_Mq4_FirstOpen_Price);}
//+------------------------------------------------------------------+
//| Calculate all pending orders for symbol                          |
//+------------------------------------------------------------------+
int CalculateAllPendingOrders(){int total=0;for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current ordersif(m_order.SelectByIndex(i))     // selects the pending order by index for further access to its propertiesif(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic)total++;
//---return(total);}
//+------------------------------------------------------------------+
//| Delete all pending orders                                                    |
//+------------------------------------------------------------------+
void DeleteAllOrders(){for(int i=OrdersTotal()-1;i>=0;i--) // returns the number of current ordersif(m_order.SelectByIndex(i))     // selects the pending order by index for further access to its propertiesif(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic)m_trade.OrderDelete(m_order.Ticket());}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void MoveOrder(){int StopsLevel=m_symbol.StopsLevel();if(StopsLevel==0)StopsLevel=m_symbol.Spread()*3;int b=0;int s=0;for(int i=0;i<OrdersTotal();i++) // returns the number of current ordersif(m_order.SelectByIndex(i))     // selects the pending order by index for further access to its propertiesif(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==m_magic){if(m_order.OrderType()==ORDER_TYPE_BUY_STOP){RefreshRates();b++;double zone=(StopsLevel+(b-1)*InpDistance)*m_symbol.Point();double newPriceOpen=m_symbol.NormalizePrice(m_symbol.Ask()+zone);if(m_order.PriceOpen()>newPriceOpen){Print("BUY:",m_order.Ticket(),",",m_order.PriceOpen(),"->",newPriceOpen,"->",m_symbol.Ask());if(NormalizeDouble(newPriceOpen-m_order.PriceOpen(),8)!=0){m_trade.OrderModify(m_order.Ticket(),newPriceOpen,m_order.StopLoss(),m_order.TakeProfit(),ORDER_TIME_GTC,0);}}}if(m_order.OrderType()==ORDER_TYPE_SELL_STOP){RefreshRates();s++;double zone=(StopsLevel+(s-1)*InpDistance)*m_symbol.Point();double newPriceOpen=m_symbol.NormalizePrice(m_symbol.Bid()-zone);if(m_order.PriceOpen()<newPriceOpen){Print("SELL:",m_order.Ticket(),",",m_order.PriceOpen(),"->",newPriceOpen,"->",m_symbol.Bid());if(NormalizeDouble(newPriceOpen-m_order.PriceOpen(),8)!=0){m_trade.OrderModify(m_order.Ticket(),newPriceOpen,m_order.StopLoss(),m_order.TakeProfit(),ORDER_TIME_GTC,0);}}}}}
//+------------------------------------------------------------------+

相关文章:

【漆学军】MT5几个重要类库的使用例子

MT5编程&#xff0c;有两种方式&#xff0c;一种是函数式编程&#xff0c;一种是面向对象编程。 面向对象编程&#xff0c;会让我们编写代码变得非常简单。 面向对象编程&#xff0c;主要是要熟悉4个类库。 #include <Trade\PositionInfo.mqh> #include <Trade\Tra…...

在 Ubuntu 24.04.1 LTS (WSL) 中使用 openssl 生成 keybox.xml

看到“生成 keybox.xml”&#xff0c;大概率都会联想到 PIF 和 Tricky Store。这里就不多解释它们的用途了。最近在网上看到生成非 AOSP keybox 的教程&#xff0c;在这里做一些补充&#xff0c;并将代码打包成一个 Python 脚本。 参考自&#xff1a; Idea 提供者&#xff1a…...

【JavaSE基础】第十六章:IO流

一、理解 1.简单而言&#xff1a;流就是内存与存储设备之间传输数据的通道、管道。 2.流的分类&#xff1a; (1) 按方向 ( 以 JVM 虚拟机为参照物 ) 【重点】 输入流&#xff1a;将< 存储设备 > 中的内容读入到 < 内存 > 中。 输…...

常见漏洞—SSRF_FastCGI

FastCGI协议 简介 Fast CGI源自旧版本的CGI 路由/结构图 # 访问url --> 浏览器生成HTTP请求报文 --> web server解析请求&#xff08;例如nginx&#xff09; web server 是内容的分发者 当访问静态页面时&#xff0c;web server 会直接返回资源&#xff0c;例如index.htm…...

LeetCode 283.移动零(超简单讲解)

283.移动零 题目示例示例1示例2 解题思路快慢指针实现设计 详细代码 题目 给定一个数组 nums&#xff0c;编写一个函数将所有 0 移动到数组的末尾&#xff0c;同时保持非零元素的相对顺序。 请注意 &#xff0c;必须在不复制数组的情况下原地对数组进行操作。 示例 示例1 …...

GIS原理及应用、地理坐标系与投影坐标系

文章目录 一、GIS定义1.1 地理信息系统1.2 建模1.3 相关教程1.4 GIS前沿方向 二、GIS数据格式2.1 矢量2.2 栅格2.3 矢量与栅格的区别 三、GIS数据组织3.1 抽象3.2 分层3.3 栅格与切片 四、坐标系4.1 坐标系简介4.2 大地坐标系GCS4.3 投影坐标系PCS4.4 投影变换 五、空间数据库与…...

用github镜像加速, --recursive还是去github站怎么处理?

小伙伴们大多碰到过github抽风的情况&#xff0c;时通时断&#xff0c;时快时慢&#xff0c;非常考验心情。 以前碰到连不上的时候&#xff0c;我大多就是在gitee和gitcode网站找一下镜像&#xff0c;找到后直接git clone 新地址即可。但是碰到 --recursive的时候就不行了&…...

ctfshow-web 151-170-文件上传

151. 我们首先想到就是上传一句话木马。但是看源代码限制了png。 &#xff08;1&#xff09;改前端代码。 这里是前端限制了上传文件类型&#xff0c;那我们就改一下就好了嘛,改成php。 这里直接修改不行&#xff0c;给大家推荐一篇简短文章&#xff0c;大家就会了&#xff08…...

【电源专题】开关转换器使能(EN)管脚的几种不同方式

我们的文章说到了很多与使能有关的电源案例和原理,如下所示: 【电源专题】案例:芯片规格书使能定义高电平最小阈值1.4V,那真的是到1.4V时才开始输出?_芯片的电流阀值-CSDN博客...

5G学习笔记之SNPN系列之ID和广播消息

目录 1. 概述 2. SNPN ID 3. SNPN广播消息 1. 概述 SNPN&#xff1a;Stand-alone Non-Public Network&#xff0c;独立的非公共网络&#xff0c;由NPN独立运营&#xff0c;不依赖与PLMN网络。 SNPN不支持的5GS特性&#xff1a; 与EPS交互 emergency services when the UE acce…...

Qt-Advanced-Docking-System配置及使用、心得

Qt-Advanced-Docking-System 1. Qt-Advanced-Docking-System描述2. 功能特点2.1. 灵活的停靠方式2.2. 嵌套停靠2.3. 自定义布局保存与恢复2.4. 外观和行为定制 3. 与Qt原生停靠系统的比较4. 使用场景4.1. 集成开发环境&#xff08;IDE&#xff09;4.2. 图形设计软件4.3. 数据分…...

【Bolt.new + PromptCoder】三分钟还原油管主页

【Bolt.new PromptCoder】三分钟还原油管主页 PromptCoder官网&#xff1a;PromptCoder Bolt官网&#xff1a;https://bolt.new/ Bolt 是什么&#xff1f; Bolt.new 是一个提供创建全栈网络应用服务的平台。它允许用户通过提示&#xff08;Prompt&#xff09;、运行&#x…...

影像组学+病理组学+深度学习人工智能应用

影像组学 基础学习内容&#xff1a; 特征提取&#xff1a;使用pyradiomics进行形状、纹理、小波变换等特征提取。特征筛选&#xff1a;应用ICC、相关系数、mRMR、Lasso等方法。建模&#xff1a;使用LR、SVM、RF、XGBoost、LightGBM等机器学习算法。模型评估&#xff1a;通过A…...

RK3568平台(基础篇)io命令支持

一.什么是io命令 “io” 命令通常用于显示 Linux 系统中的 I/O 统计信息。它提供了有关磁盘读写操作的详细信息,包括每个块设备的读写次数、读写扇区数、读写延迟等。io命令可以直接操作某个寄存器,用于查看设置某个GPIO 引脚配置了什么iomux。 二.io命令支持 RK平台要支持…...

Yolov8源码分析

1、目录介绍 主要目录ultralitics&#xff08;重点&#xff09; 1、assets目录 这个文件保存了YOLO历史上可以说是最经典的两张图片&#xff0c;供大家测试程序来使用的。 2、cfg 这个文件下面保存了我们的模型配置文件&#xff0c;cfg目录是项目配置的集中地&#xff0c;其…...

Python中的装饰器`@functools.lru_cache`:用法、来源与应用 (中英双语)

今天看到一段源码 https://github.com/google-research/google-research/blob/master/instruction_following_eval/instructions_util.py 如下&#xff0c;对其中使用的装饰器函数感到好奇&#xff0c;所以产生了这篇博客。 functools.lru_cache(maxsizeNone) def _get_sentenc…...

思维图(GoT):解锁大模型解决复杂问题的能力

今天分享的是苏黎世联邦理工学院、华沙理工大学和Cledar联合发表的一篇文章&#xff1a;思维图&#xff1a;用大语言模型解决复杂问题 论文题目&#xff1a;Graph of Thoughts: Solving Elaborate Problems with Large Language Models 论文链接&#xff1a;https://arxiv.or…...

使用winscp从windows访问Ubuntu进行文件传输

Ubuntu 系统上的准备工作 • 安装 SSH 服务器&#xff1a; 确保 Ubuntu 系统上已经安装了 SSH 服务器。如果没有安装&#xff0c;可以使用以下命令安装&#xff1a; sudo apt update sudo apt install openssh-server • 启动 SSH 服务&#xff1a; 确保 SSH 服务正在运行&a…...

Java全栈项目:实验室预约管理系统的设计与实现

一、项目介绍 实验室预约管理系统是一个基于Java全栈技术开发的Web应用系统&#xff0c;旨在提供便捷的实验室预约、管理和使用体验。本系统主要面向高校师生&#xff0c;实现实验室资源的智能化、信息化管理。 二、技术栈 前端技术 Vue.jsElement UIAxiosVue RouterVuex …...

使用 esrally race 测试 Elasticsearch 性能及 Kibana 可视化分析指南

前言&#xff1a; 在对 Elasticsearch 集群进行性能测试与调优的过程中&#xff0c;esrally 是官方推荐的测试工具。通过 esrally race 命令&#xff0c;我们可以模拟各种查询与索引负载&#xff0c;对集群进行基准测试。然而&#xff0c;仅看 esrally 的终端输出并不直观&…...

linux之kylin系统nginx的安装

一、nginx的作用 1.可做高性能的web服务器 直接处理静态资源&#xff08;HTML/CSS/图片等&#xff09;&#xff0c;响应速度远超传统服务器类似apache支持高并发连接 2.反向代理服务器 隐藏后端服务器IP地址&#xff0c;提高安全性 3.负载均衡服务器 支持多种策略分发流量…...

安宝特方案丨XRSOP人员作业标准化管理平台:AR智慧点检验收套件

在选煤厂、化工厂、钢铁厂等过程生产型企业&#xff0c;其生产设备的运行效率和非计划停机对工业制造效益有较大影响。 随着企业自动化和智能化建设的推进&#xff0c;需提前预防假检、错检、漏检&#xff0c;推动智慧生产运维系统数据的流动和现场赋能应用。同时&#xff0c;…...

2.Vue编写一个app

1.src中重要的组成 1.1main.ts // 引入createApp用于创建应用 import { createApp } from "vue"; // 引用App根组件 import App from ./App.vue;createApp(App).mount(#app)1.2 App.vue 其中要写三种标签 <template> <!--html--> </template>…...

【AI学习】三、AI算法中的向量

在人工智能&#xff08;AI&#xff09;算法中&#xff0c;向量&#xff08;Vector&#xff09;是一种将现实世界中的数据&#xff08;如图像、文本、音频等&#xff09;转化为计算机可处理的数值型特征表示的工具。它是连接人类认知&#xff08;如语义、视觉特征&#xff09;与…...

让AI看见世界:MCP协议与服务器的工作原理

让AI看见世界&#xff1a;MCP协议与服务器的工作原理 MCP&#xff08;Model Context Protocol&#xff09;是一种创新的通信协议&#xff0c;旨在让大型语言模型能够安全、高效地与外部资源进行交互。在AI技术快速发展的今天&#xff0c;MCP正成为连接AI与现实世界的重要桥梁。…...

抽象类和接口(全)

一、抽象类 1.概念&#xff1a;如果⼀个类中没有包含⾜够的信息来描绘⼀个具体的对象&#xff0c;这样的类就是抽象类。 像是没有实际⼯作的⽅法,我们可以把它设计成⼀个抽象⽅法&#xff0c;包含抽象⽅法的类我们称为抽象类。 2.语法 在Java中&#xff0c;⼀个类如果被 abs…...

【深度学习新浪潮】什么是credit assignment problem?

Credit Assignment Problem(信用分配问题) 是机器学习,尤其是强化学习(RL)中的核心挑战之一,指的是如何将最终的奖励或惩罚准确地分配给导致该结果的各个中间动作或决策。在序列决策任务中,智能体执行一系列动作后获得一个最终奖励,但每个动作对最终结果的贡献程度往往…...

Vue 3 + WebSocket 实战:公司通知实时推送功能详解

&#x1f4e2; Vue 3 WebSocket 实战&#xff1a;公司通知实时推送功能详解 &#x1f4cc; 收藏 点赞 关注&#xff0c;项目中要用到推送功能时就不怕找不到了&#xff01; 实时通知是企业系统中常见的功能&#xff0c;比如&#xff1a;管理员发布通知后&#xff0c;所有用户…...

数据分析六部曲?

引言 上一章我们说到了数据分析六部曲&#xff0c;何谓六部曲呢&#xff1f; 其实啊&#xff0c;数据分析没那么难&#xff0c;只要掌握了下面这六个步骤&#xff0c;也就是数据分析六部曲&#xff0c;就算你是个啥都不懂的小白&#xff0c;也能慢慢上手做数据分析啦。 第一…...

汇编语言学习(三)——DoxBox中debug的使用

目录 一、安装DoxBox&#xff0c;并下载汇编工具&#xff08;MASM文件&#xff09; 二、debug是什么 三、debug中的命令 一、安装DoxBox&#xff0c;并下载汇编工具&#xff08;MASM文件&#xff09; 链接&#xff1a; https://pan.baidu.com/s/1IbyJj-JIkl_oMOJmkKiaGQ?pw…...