使用,如果一个变量的值为 1而另一个变量的值为 3 MQL4
,我如何执行BUY
订单(见下文) ?x
y
我需要它像这样工作:
多变的x = 1
多变的y = 3
所以如果x
是MORE THAN y
,执行这个脚本:
extern int TakeProfit = 10;
extern int StopLoss = 10;
void OnStart()
{
double TakeProfitLevel;
double StopLossLevel;
TakeProfitLevel = Bid + TakeProfit*Point;
StopLossLevel = Bid - StopLoss*Point;
Alert("TakeProfitLevel = ", TakeProfitLevel);
Alert("StopLossLevel = ", StopLossLevel);
OrderSend("USDCAD", OP_BUY, 1.0, Ask, 10, StopLossLevel, TakeProfitLevel, "first order");
}
如果x
是LESS THAN y
,则执行此SELL
脚本:
extern int TakeProfit = 10;
extern int StopLoss = 10;
void OnStart()
{
double TakeProfitLevel;
double StopLossLevel;
TakeProfitLevel = Bid + TakeProfit*Point;
StopLossLevel = Bid - StopLoss*Point;
Alert("TakeProfitLevel = ", TakeProfitLevel);
Alert("StopLossLevel = ", StopLossLevel);
OrderSend("USDCAD", OP_SELL, 1.0, Ask, 10, StopLossLevel, TakeProfitLevel, "first order");
}
我正在努力寻找MQL4
建立变量的代码,然后可以相互比较x > y
,反之亦然,所以任何帮助将不胜感激。