有懂MQL4代码的朋友帮我看一下
本帖最后由 qdqqqg 于 2023-11-24 14:25 编辑就是上根K线为阳线和上根K线最低价小于前5根范围最低价,买入测试结果上根K线为阳线是对了的,上根K最低价小于前5根范围最低价条件都没有达到为什么也会买入呢?
// 定义买入手数
double lots = 0.01;
// 获取上根K线的引线最低价
double shadow_low_prev = MathMin(iOpen(NULL, 0, 1), iClose(NULL, 0, 1)) - iLow(NULL, 0, 1);
// 获取前5根K线范围内的引线最低价
double min_shadow_low_offset = MathMin(iLow(NULL, 0, 1), iLow(NULL, 0, 2));
for (int i = 3; i <= 7; i++) {
min_shadow_low_offset = MathMin(min_shadow_low_offset, iLow(NULL, 0, i));
}
// 判断条件
if (iClose(NULL, 0, 1) > iOpen(NULL, 0, 1) && shadow_low_prev < min_shadow_low_offset) {
// 条件成立,执行买入操作
OrderSend("Symbol", OP_BUY, lots, Ask, 3, 0, 0, "Buy order", 0, 0, Green);
}
联系我qq1369112150
页:
[1]