为稳定盈利 提供动力

这里是我的工作总结和我感性上的碎碎念 3BFund Quant leader CFA 从业6Y Email: wongmanc@88.com

MQL4震荡指示器(源码)

,

#property copyright “by王满仓源码获取连接↓”
#property link “https://www.wongmanc.com/”
#property version “1.0”
#property strict
#property description “EA-震荡指示器”

input int RSI_Period = 60; // 指标计算周期
input double Upper_Limit = 55.0; // 指标上限值
input double Lower_Limit = 45.0; // 指标下限值
input ENUM_TIMEFRAMES TimeFrame = PERIOD_H1; // 使用的时间框架
input int UpdateInterval = 1; // 更新间隔(秒)

string gComment = “”; // 全局注释变量

//+——————————————————————+
//| 专家初始化函数 |
//+——————————————————————+
int OnInit()
{
EventSetTimer(UpdateInterval); // 设置定时器
return INIT_SUCCEEDED;
}

//+——————————————————————+
//| 定时器事件处理函数 |
//+——————————————————————+
void OnTimer()
{
string insideRange = “”; // 初始化范围内货币对字符串

// 遍历市场观察窗口中的所有货币对
for(int i = 0; i < SymbolsTotal(false); i++)
{
string symbol = SymbolName(i, false); // 获取货币对名称
double rsi = iRSI(symbol, TimeFrame, RSI_Period, PRICE_CLOSE, 0); // 计算RSI

// 检查RSI是否在指定范围内
if(rsi >= Lower_Limit && rsi <= Upper_Limit)
{
// 如果在范围内,将货币对添加到范围内字符串
insideRange += symbol + “\n”;
}
}

// 构建完整的注释内容
gComment = “在指定范围 (” + DoubleToString(Lower_Limit, 2) + ” – ” + DoubleToString(Upper_Limit, 2) + “) 的货币对:\n” + insideRange;

// 更新图表注释
Comment(gComment);
}

//+——————————————————————+
//| 专家去初始化函数 |
//+——————————————————————+
void OnDeinit(const int reason)
{
EventKillTimer(); // 停止定时器
}
//+——————————————————————+


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注