简体   繁体   English

关于编码mt4止盈点的问题

[英]question on coding take profit point of mt4

I have question on take profit point of mt4:我对 mt4 的获利点有疑问:

I would like to set take profit point to stop loss * 2, so the code should be:我想将止盈点设置为止损* 2,所以代码应该是:

takeprofit = NormalizeDouble((Ask + ((Ask - stoploss)*Point()*2) + StopLevel*Point()),Digits);

However, it won't works, so anyone know how to fix it?但是,它不起作用,所以有人知道如何解决它吗? I am new to mq4 coder.我是 mq4 编码器的新手。 Thanks谢谢

Remember that you need to differentiate between BUY and SELL orders.请记住,您需要区分买单和卖单。

You also look like you are getting confused with stoploss and StopLevel .您看起来也对stoplossStopLevel感到困惑。 I'm assuming that your StopLevel is the distance of your stoploss in points.我假设您的StopLevel是您的止损点的距离。

If that is the case, your code should look something like this (you don't need to reference StopLevel if you already have the distance in Points):如果是这种情况,您的代码应如下所示(如果您已经有 Points 距离,则无需引用 StopLevel):

if(ordertype==OP_BUY) takeprofit = NormalizeDouble(Ask+StopLevel*2*Point,Digits);
else takeprofit = NormalizeDouble(Bid-StopLevel*2*Point,Digits);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM