请观看如何免费下载自动交易
请在Facebook上找到我们!
加入我们粉丝页
有趣的脚本?
因此发布一个链接 -
让其他人评价
喜欢这个脚本? 在MetaTrader 5客户端尝试它
程序库

检查是否有新柱产生 - MetaTrader 5程序库

显示:
2410
等级:
(4)
已发布:
2023.05.27 09:42
\MQL5\Include\
Check.mqh (3.96 KB) 预览
需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务

1、类函数只有一个,没有额外变量。 使用前请申明类 CCheck 

class CCheck
  {
public:
   bool              isNewBar(const string symbol,const ENUM_TIMEFRAMES period);
   
  };


2、程序内变量用于保存对应数据,历史柱变量需用静态修饰,以便数据保存

//--- Static variables used to save history bar time
   static datetime time_OldBar = 0;   
   
//--- used to save the latest bar time
   datetime time_NewBar = 0;    //Latest bar time
   long     var = 0;            //Temporary variables

 

3、此处是获取最新柱时间的函数,使用此函数,系统运行最快,因此使用它。当其返回 False,函数并不会退出,如有需要可检查错误代码

//--- SeriesInfoInteger() this function runs the fastest, so use it
   if(!SeriesInfoInteger(symbol,period,SERIES_LASTBAR_DATE,var))
      {
      ResetLastError();
      Print("Error in obtaining the latest bar time. Code:",GetLastError());
      }
      else time_NewBar = datetime(var);


4、第一次使用的时候,将会对历史数据存放处进行赋初值,以便后续比较

//--- First function call, assign a value
   if(time_OldBar == 0)		//static datetime time_OldBar
     {
      time_OldBar = time_NewBar;
      return(false); 
     }


5、对比新旧时间柱,有不一样,则代表有新柱产生,返回true。时间相同,则没有新柱,返回false 

//--- The time of new and old bar is different, it means there is a new bar, or is not a new bar
   if(time_OldBar != time_NewBar)
     {
      time_OldBar = time_NewBar; 
      return(true); 
     }
     else return(false);


6、使用方法:


    Moving Average-RMA 相对移动平均线 Moving Average-RMA 相对移动平均线

    Relative Moving Average (RMA) is a variant of EMA the factor is 1/period

    Laguerre filter - no gamma with arrow Laguerre filter - no gamma with arrow

    拉盖尔过滤器 - no gamma 基础上增加了买卖信号指示。

    KYjiaoyi KYjiaoyi

    以ama和rsi指标作为交易标准

    使用ONNX模型识别手写数字的示例 使用ONNX模型识别手写数字的示例

    此EA不用于交易。使用标准Canvas库实现的简单面板允许您用鼠标绘制数字。经过测试的mnist.onnx模型用于识别数字。