mt4开买仓止损哪个更正确?

问题描述 投票:0回答:1

到目前为止,我确实毫无疑问地使用了这个公式。

stoploss = NormalizeDouble(Ask - StopLossInPoint * Point, Digits);

但是今天突然的价格暴涨让我又开始思考了。 我猜测当时的要价(XAUUSD,2023.11.14 GMT+2 15:30)太大了。 因为我的日志消息说用上述公式计算的止损(基于 300 点)甚至大于图表显示的价格水平(我希望这是我在图表中看到的买入价),而它应该小于它。

Long Order Failed with error #130, which means invalid stop loss.

所以我认为点差已接近300点,未能开仓。

  • 我可以像这样使用 Bid 来计算买入仓位的止损吗?

    stoploss = NormalizeDouble(Bid - StopLossInPoint * Point, Digits);

  • 使用 Bid 会带来什么意想不到的结果?

有些网站需要使用Bid
https://www.earnforex.com/guides/ordersend-error-130/
我检查了github上的开源代码,其中很多都是基于Ask

trading algorithmic-trading mql4 metatrader4 mt4
1个回答
0
投票

恕我直言,对于购买订单,您应该使用

double sl = NormalizeDouble(symbolInfo.Bid() - StopLevel * point, (int)digits);

对于卖出订单,您应该使用

double sl = NormalizeDouble(symbolInfo.Ask() + StopLevel * point, (int)digits);

-它来自我的 mql5,但在旧版本中几乎相同

我多年来一直这样使用它,没有任何问题

您发布链接的网站上也建议了同样的事情。

© www.soinside.com 2019 - 2024. All rights reserved.