如何编码? - 页 144 1...137138139140141142143144145146147148149150151...347 新评论 Michel 2008.11.12 15:40 #1431 这是错误的:如果(totalOrders==0 && Magic==OrderMagicNumber() && OrderSelect(i-1 , SELECT_BY_POS,MODE_HISTORY) ==true) 因为你在OrderSelect()之前 调用OrderMagicNumber(),所以它可能是指之前的调用。 Roger09 2008.11.12 16:54 #1432 EBK: 哦,对不起,我错误地表达了我的观点。我想编写一些代码(但我无法做到),如果股权低于某个值,将停止EA交易(或EA交易的一部分)。 谢谢你的帮助,Roger09,但我不需要在图表上显示资产。 试试这个EA CloseAllBuySell - MQL4代码基础 使用它的想法,制作一个代码,如 if (AccountEquity()<YourValue) closeallorders()。 Beno 2008.11.15 14:25 #1433 谁能把EMA追踪止损添加到移动平均线 EA样本中? EMA尾随设置为1 然后将入口改为 Buy=Open[1]>ma && Close[1]>ma; Sell=Open[1]<ma && Close[1]<ma。 这应该是一个非常好的简单剥头皮程序。 谢谢 贝诺 附加的文件: ematrailingstop_v1.mq4 5 kb [删除] 2008.11.15 23:58 #1434 Roger09 2008.11.16 17:29 #1435 在程序的开头添加 extern int pips=2;//(或你的点数) 然后替换为 if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice())) sl = OrderOpenPrice() ; if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice())) sl = OrderOpenPrice() ;[/CODE] to [CODE]if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice())) sl = OrderOpenPrice() +pips*Point; if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice())) sl = OrderOpenPrice() -pips*Point; [删除] 2008.11.17 17:28 #1436 谁能帮我在这个指标中设置一个警报,当它画出一个新的箭头时? 谢谢! 附加的文件: hilow3.mq4 2 kb Roger09 2008.11.17 23:44 #1437 不,修复它 extern int pips=2; //+------------------------------------------------------------------+ //| 脚本程序启动功能| //+------------------------------------------------------------------+ int start() { //---- string curr = Symbol(); int ot = OrdersTotal(); int ords[200], ordType[200], ordTicket[200]; double ordLots[200]; 字符串 ordComments[200]。 int ix=0。 for (int i=0; i<ot; i++) { int o = OrderSelect(i, SELECT_BY_POS)。 如果(OrderSymbol() == Symbol() 如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL)) { double sl = 0。 如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() )) sl = OrderOpenPrice() +pips*Point; 如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice())) sl = OrderOpenPrice() -pips*Point; 如果(sl != 0+10) OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。 } } //---- return(0); 编码帮助 How to code? 问吧! [删除] 2008.11.18 01:36 #1438 好了,现在的代码看起来像这样。 extern int pips=10;// //+------------------------------------------------------------------+ //| 脚本程序启动功能| //+------------------------------------------------------------------+ int start() { //---- string curr = Symbol(); int ot = OrdersTotal(); int ords[200], ordType[200], ordTicket[200]; double ordLots[200]; 字符串 ordComments[200]。 int ix=0。 for (int i=0; i<ot; i++) { int o = OrderSelect(i, SELECT_BY_POS)。 如果(OrderSymbol() == Symbol() 如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL)) { double sl = 0。 如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() )) sl = OrderOpenPrice() +pips*Point; 如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice())) sl = OrderOpenPrice() -pips*Point; 如果(sl != 0) OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。 } } //---- 返回(0)。 } //+------------------------------------------------------------------+ 编码帮助 How to code? 问吧! [删除] 2008.11.18 01:37 #1439 嗨,Roger09。 非常感谢你对这段代码的帮助。我的脚本代码现在看起来是这样的(我添加了红色的修改,只是为了这个回复,MQ4中的代码看起来就像其他地方的代码)。 //+------------------------------------------------------------------+ //| 脚本程序启动功能 //+------------------------------------------------------------------+ int start() { //---- 外来的int pips=2;// string curr = Symbol(); int ot = OrdersTotal(); int ords[200], ordType[200], ordTicket[200]; double ordLots[200]; 字符串 ordComments[200]。 int ix=0。 for (int i=0; i<ot; i++) { int o = OrderSelect(i, SELECT_BY_POS)。 如果(OrderSymbol() == Symbol() 如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL)) { double sl = 0。 如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() )) sl = OrderOpenPrice() +pips*Point; 如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice())) sl = OrderOpenPrice() -pips*Point; 如果(sl != 0) OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。 } } //---- 返回(0)。 你能让我知道我的理解是否正确吗?我在这里是盲目的,所以请容忍我。 编码帮助 How to code? 问吧! Roger09 2008.11.18 04:31 #1440 事实上,这将是可行的,但这个代码并不好。不幸的是,我不知道你的主要目标,不能推荐其他东西。 1...137138139140141142143144145146147148149150151...347 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
这是错误的:如果(totalOrders==0 && Magic==OrderMagicNumber() &&
OrderSelect(i-1 , SELECT_BY_POS,MODE_HISTORY) ==true)
因为你在OrderSelect()之前 调用OrderMagicNumber(),所以它可能是指之前的调用。
哦,对不起,我错误地表达了我的观点。
我想编写一些代码(但我无法做到),如果股权低于某个值,将停止EA交易(或EA交易的一部分)。
谢谢你的帮助,Roger09,但我不需要在图表上显示资产。试试这个EA
CloseAllBuySell - MQL4代码基础
使用它的想法,制作一个代码,如
if (AccountEquity()<YourValue) closeallorders()。
谁能把EMA追踪止损添加到移动平均线 EA样本中?
EMA尾随设置为1
然后将入口改为
Buy=Open[1]>ma && Close[1]>ma;
Sell=Open[1]<ma && Close[1]<ma。
这应该是一个非常好的简单剥头皮程序。
谢谢
贝诺
在程序的开头添加
extern int pips=2;//(或你的点数)
然后替换为
sl = OrderOpenPrice() ;
if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))
sl = OrderOpenPrice() ;[/CODE]
to
[CODE]if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))
sl = OrderOpenPrice() +pips*Point;
if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))
sl = OrderOpenPrice() -pips*Point;谁能帮我在这个指标中设置一个警报,当它画出一个新的箭头时?
谢谢!
不,修复它
extern int pips=2;
//+------------------------------------------------------------------+
//| 脚本程序启动功能|
//+------------------------------------------------------------------+
int start()
{
//----
string curr = Symbol();
int ot = OrdersTotal();
int ords[200], ordType[200], ordTicket[200]; double ordLots[200];
字符串 ordComments[200]。
int ix=0。
for (int i=0; i<ot; i++)
{
int o = OrderSelect(i, SELECT_BY_POS)。
如果(OrderSymbol() == Symbol()
如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL))
{
double sl = 0。
如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() ))
sl = OrderOpenPrice() +pips*Point;
如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))
sl = OrderOpenPrice() -pips*Point;
如果(sl != 0+10)
OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。
}
}
//----
return(0);
好了,现在的代码看起来像这样。
extern int pips=10;//
//+------------------------------------------------------------------+
//| 脚本程序启动功能|
//+------------------------------------------------------------------+
int start()
{
//----
string curr = Symbol();
int ot = OrdersTotal();
int ords[200], ordType[200], ordTicket[200]; double ordLots[200];
字符串 ordComments[200]。
int ix=0。
for (int i=0; i<ot; i++)
{
int o = OrderSelect(i, SELECT_BY_POS)。
如果(OrderSymbol() == Symbol()
如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL))
{
double sl = 0。
如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() ))
sl = OrderOpenPrice() +pips*Point;
如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))
sl = OrderOpenPrice() -pips*Point;
如果(sl != 0)
OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。
}
}
//----
返回(0)。
}
//+------------------------------------------------------------------+
嗨,Roger09。
非常感谢你对这段代码的帮助。我的脚本代码现在看起来是这样的(我添加了红色的修改,只是为了这个回复,MQ4中的代码看起来就像其他地方的代码)。
//+------------------------------------------------------------------+
//| 脚本程序启动功能
//+------------------------------------------------------------------+
int start()
{
//----
外来的int pips=2;//
string curr = Symbol();
int ot = OrdersTotal();
int ords[200], ordType[200], ordTicket[200]; double ordLots[200];
字符串 ordComments[200]。
int ix=0。
for (int i=0; i<ot; i++)
{
int o = OrderSelect(i, SELECT_BY_POS)。
如果(OrderSymbol() == Symbol()
如果((OrderType() == OP_BUY)|| (OrderType() == OP_SELL))
{
double sl = 0。
如果((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice() ))
sl = OrderOpenPrice() +pips*Point;
如果((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))
sl = OrderOpenPrice() -pips*Point;
如果(sl != 0)
OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0)。
}
}
//----
返回(0)。
你能让我知道我的理解是否正确吗?我在这里是盲目的,所以请容忍我。
事实上,这将是可行的,但这个代码并不好。不幸的是,我不知道你的主要目标,不能推荐其他东西。