问吧! - 页 77 1...707172737475767778798081828384...182 新评论 fxgroup 2007.08.29 07:01 #761 To CodersGuru : 需要帮助关于10点3EA.... 你好,CodersGuru。 我是外汇交易 的新手,也是这个论坛的新手。我第一次学习的是EuroX2_sl,由10点3EA脚本扩展而来。在做了一些前向测试后,这个EA很好地打开了头寸,但在市场逆转时,它并没有像我需要的那样很好地关闭头寸。也许是代码出了问题(因为我不是程序员),我想我需要你的帮助来解决这个问题。请检查一下哪部分可能出错了? 条件是。 1.当指标条件存在时打开买入,即:随机指数 2.2.当开放卖出指标存在时关闭买入,即:随机指数 3.当指标条件(上述第2项)存在时打开卖出,即:随机指数 4.当指标条件(上述第1项)存在时,关闭卖出。 我认为开仓没有问题,但问题出在关仓上,因为即使指标存在,它也没有关仓(买入或卖出)。 我的代码是: -------- EuroX2_sl脚本的一部分,从10点扩展到3点,因为我认为关闭位置------- // 正确地进入市场是很重要的。 // 但更重要的是正确退出...... for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。 if(OrderType()<=OP_SELL && // 检查开仓情况 OrderType()<=OP_BUY && //检查开仓情况 OrderType()>=OP_SELL&&。 订单类型()>=OP_BUY&&。 OrderSymbol()==Symbol())// 检查符号 { //+-------------------------------------------------------------- 如果(OrderType()==OP_BUY)//多头头寸被打开 { //+------------------------------------------------------------------- //+ 平仓的条件 //+------------------------------------------------------------------- //+--------------- 关闭买入头寸 ---------------------------- 如果 ( Stoch_Main_M15_Cu < Stoch_Sig_M15_Cu ) //+------------------------------------------------------------------ { OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; //平仓 return(0); // 退出 } //+----------------------------------------------------------------------- // 检查拖曳式止损 如果(TrailingStop>0){ 如果(Bid-OrderOpenPrice()>Point*TrailingStop) { 如果(OrderStopLoss()<Bid-Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green) 。 返回(0)。 } } } } //+--------------- 关闭卖出头寸 -------------------------------- 否则 // 转入空头头寸 { //+ 不要删除 if(OrderType()==OP_SELL) //空头头寸被打开 { } //应该关闭吗? //+---------------------------------------------------------------------------- if ( Stoch_Main_M15_Cu > Stoch_Sig_M15_Cu ) //+----------------------------------------------------------------------------- { OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet) ; //平仓 return(0); // 退出 } //+---------------------------------------- // 检查拖曳式止损 如果(TrailingStop>0){ 如果((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { 如果((OrderStopLoss()>(Ask+Point*TrailingStop))|| (OrderStopLoss()==0)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red) 。 返回(0)。 } } } } } } -------------------------------------------------------------- 谢谢你。 fxgroup 如何编码? 10点3.mq4 [存档]任何菜鸟问题,为了不使论坛变得杂乱无章。专业人士,不要路过。没有你就无处可去 - 3. european 2007.08.29 14:50 #762 从另一个货币对 窗口读取数据 我的EA是在 "GBPJPY "窗口,但我需要找到另一个窗口的ObjectDescription(),比如 "USDJPY"。(不幸的是,这是一个Pivot指标,不能从iCustom()返回值)。 有谁知道如何引用另一个(非当前)货币对窗口,以便能够在其上使用ObjectDescription()这样的函数? 还是MQ4不允许这样做? 谢谢你 欧元 1Dave7 2007.08.29 15:29 #763 我如何将一种货币的利润与其他货币隔离开来? color color_of_pipsprofit; color_of_pipsprofit = White; int m,totalbuy; totalbuy=OrdersTotal(); for(m=0;m<totalbuy;m++) OrderSelect(m, SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) { pips_profit=OrderProfit(); } if(pips_profit >= 0) { color_of_pipsprofit = Lime; } else {color_of_pipsprofit = Red; } int n,totalsell; totalsell=OrdersTotal(); for(n=0;n<totalsell;n++) OrderSelect(n, SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) { pips=OrderProfit(); } if(pips_profit >= 0) { color_of_pipsprofit = Lime; } else {color_of_pipsprofit = Red; } ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0); ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit); ObjectSet("pips_profit", OBJPROP_CORNER, 3); ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35); ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20); } 我创建了这个编码,但我无法将一种货币的利润与其他正在交易的货币分开。 我的代码中缺少什么? 请审查。 谢谢您的帮助! 戴夫 Ask! 如何编码? How to code? Ahmed Soliman 2007.08.29 16:11 #764 盈利 试试这个代码。 int start() { int total = OrdersTotal(); for (int cnt = total ; cnt >=0 ; cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber) { Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice()); } } return(0); } double Profit(int type, string currency, double open) { if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy return(-1); }[/php] 1Dave7:[php] color color_of_pipsprofit; color_of_pipsprofit = White; int m,totalbuy; totalbuy=OrdersTotal(); for(m=0;m<totalbuy;m++) OrderSelect(m, SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) { pips_profit=OrderProfit(); } if(pips_profit >= 0) { color_of_pipsprofit = Lime; } else {color_of_pipsprofit = Red; } int n,totalsell; totalsell=OrdersTotal(); for(n=0;n<totalsell;n++) OrderSelect(n, SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) { pips=OrderProfit(); } if(pips_profit >= 0) { color_of_pipsprofit = Lime; } else {color_of_pipsprofit = Red; } ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0); ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit); ObjectSet("pips_profit", OBJPROP_CORNER, 3); ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35); ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20); } I created this coding, but I cannot isolate the profits of one currency from other currencies being traded. What am I lacking in my code?? Please review. Thanks for your help! Dave Ask! 初学者的问题 MQL5 MT5 MetaTrader 如何编码? 1Dave7 2007.08.29 17:07 #765 codersguru: 试试这个代码。 int start() { int total = OrdersTotal(); for (int cnt = total ; cnt >=0 ; cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber) { Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice()); } } return(0); } double Profit(int type, string currency, double open) { if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy return(-1); } 嗨,编码员。 这并不是我所需要的。 我附上一张图片来说明我所寻找的东西。 你能修改编码以显示利润吗? 如果可以的话,我可以让颜色根据利润额变化。 我只是在寻找每种特定货币的利润。 附加的文件: display_of_graph_using_ea.gif 16 kb monty1 2007.08.30 15:53 #766 附带的指标 嗨,Codersguru 我希望所附的指标能在格林威治时间的午夜显示开盘,而不是经纪人的服务器时间,这可能吗? 感谢Monty 附加的文件: prevdayandfloatingpivot_o.mq4 4 kb prevdayandfloatingpivot_o.ex4 4 kb Richard 2007.09.02 16:08 #767 对代码的帮助 你能解释一下代码吗? 我得到一个不正确的值(见下面的 "账户"),然后它被正确地填充,但我不确定为什么。 int Account = 123456; if (Account != AccountNumber()) { Comment("你不能用这个账户来使用这个程序")。 返回(0)。 } 否则 { Comment("Welcome to Program"); } n7drazen 2007.09.04 08:36 #768 简单的问题 如果没有init()和deinit()函数,专家顾问能否正常运行? Kale 2007.09.04 08:50 #769 n7drazen: 如果没有init()和deinit()函数,专家顾问能否正常运行? 是的。 只需要启动函数。 FXMan77 2007.09.04 09:31 #770 卡伦佐。 我有一个问题。 HEDGING。 我在寻找 如果(OrderOpenPrice() = = Bid (或Ask) 开仓价格 必须与新价格相等。 我用相同的货币对EURUSD进行套期保值。 如果开盘价是卖出,价格是1.3580。 买入价格必须是相同的。 谢谢。以下是代码。 B. //------------------------------------------ if(Buy==0) { RefreshRates()。 OrderSend(Symbol_1,OP_BUY,lotsi,MarketInfo(Symbol_1,MODE_ASK),... RefreshRates()。 如果(OrderOpenPrice() == Bid) { OrderSend(Symbol_1,OP_SELL,lotsi,MarketInfo(Symbol _1,MODE_BID),。 } 1...707172737475767778798081828384...182 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
To CodersGuru : 需要帮助关于10点3EA....
你好,CodersGuru。
我是外汇交易 的新手,也是这个论坛的新手。我第一次学习的是EuroX2_sl,由10点3EA脚本扩展而来。在做了一些前向测试后,这个EA很好地打开了头寸,但在市场逆转时,它并没有像我需要的那样很好地关闭头寸。也许是代码出了问题(因为我不是程序员),我想我需要你的帮助来解决这个问题。请检查一下哪部分可能出错了?
条件是。
1.当指标条件存在时打开买入,即:随机指数
2.2.当开放卖出指标存在时关闭买入,即:随机指数
3.当指标条件(上述第2项)存在时打开卖出,即:随机指数
4.当指标条件(上述第1项)存在时,关闭卖出。
我认为开仓没有问题,但问题出在关仓上,因为即使指标存在,它也没有关仓(买入或卖出)。
我的代码是:
-------- EuroX2_sl脚本的一部分,从10点扩展到3点,因为我认为关闭位置-------
// 正确地进入市场是很重要的。
// 但更重要的是正确退出......
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)。
if(OrderType()<=OP_SELL && // 检查开仓情况
OrderType()<=OP_BUY && //检查开仓情况
OrderType()>=OP_SELL&&。
订单类型()>=OP_BUY&&。
OrderSymbol()==Symbol())// 检查符号
{
//+--------------------------------------------------------------
如果(OrderType()==OP_BUY)//多头头寸被打开
{
//+-------------------------------------------------------------------
//+ 平仓的条件
//+-------------------------------------------------------------------
//+--------------- 关闭买入头寸 ----------------------------
如果 ( Stoch_Main_M15_Cu < Stoch_Sig_M15_Cu )
//+------------------------------------------------------------------
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; //平仓
return(0); // 退出
}
//+-----------------------------------------------------------------------
// 检查拖曳式止损
如果(TrailingStop>0){
如果(Bid-OrderOpenPrice()>Point*TrailingStop)
{
如果(OrderStopLoss()<Bid-Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green) 。
返回(0)。
}
}
}
}
//+--------------- 关闭卖出头寸 --------------------------------
否则 // 转入空头头寸
{ //+ 不要删除
if(OrderType()==OP_SELL) //空头头寸被打开
{
}
//应该关闭吗?
//+----------------------------------------------------------------------------
if ( Stoch_Main_M15_Cu > Stoch_Sig_M15_Cu )
//+-----------------------------------------------------------------------------
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet) ; //平仓
return(0); // 退出
}
//+----------------------------------------
// 检查拖曳式止损
如果(TrailingStop>0){
如果((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
如果((OrderStopLoss()>(Ask+Point*TrailingStop))|| (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red) 。
返回(0)。
}
}
}
}
}
}
--------------------------------------------------------------
谢谢你。
fxgroup
从另一个货币对 窗口读取数据
我的EA是在 "GBPJPY "窗口,但我需要找到另一个窗口的ObjectDescription(),比如 "USDJPY"。(不幸的是,这是一个Pivot指标,不能从iCustom()返回值)。
有谁知道如何引用另一个(非当前)货币对窗口,以便能够在其上使用ObjectDescription()这样的函数?
还是MQ4不允许这样做?
谢谢你
欧元
我如何将一种货币的利润与其他货币隔离开来?
color color_of_pipsprofit;
color_of_pipsprofit = White;
int m,totalbuy;
totalbuy=OrdersTotal();
for(m=0;m<totalbuy;m++)
OrderSelect(m, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)
{
pips_profit=OrderProfit();
}
if(pips_profit >= 0)
{
color_of_pipsprofit = Lime;
}
else {color_of_pipsprofit = Red;
}
int n,totalsell;
totalsell=OrdersTotal();
for(n=0;n<totalsell;n++)
OrderSelect(n, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)
{
pips=OrderProfit();
}
if(pips_profit >= 0)
{
color_of_pipsprofit = Lime;
}
else {color_of_pipsprofit = Red;
}
ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);
ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);
ObjectSet("pips_profit", OBJPROP_CORNER, 3);
ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);
ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);
}我创建了这个编码,但我无法将一种货币的利润与其他正在交易的货币分开。 我的代码中缺少什么?
请审查。 谢谢您的帮助!
戴夫
盈利
试试这个代码。
{
int total = OrdersTotal();
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)
{
Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());
}
}
return(0);
}
double Profit(int type, string currency, double open)
{
if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy
if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy
return(-1);
}[/php]
[php]
color color_of_pipsprofit;
color_of_pipsprofit = White;
int m,totalbuy;
totalbuy=OrdersTotal();
for(m=0;m<totalbuy;m++)
OrderSelect(m, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)
{
pips_profit=OrderProfit();
}
if(pips_profit >= 0)
{
color_of_pipsprofit = Lime;
}
else {color_of_pipsprofit = Red;
}
int n,totalsell;
totalsell=OrdersTotal();
for(n=0;n<totalsell;n++)
OrderSelect(n, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)
{
pips=OrderProfit();
}
if(pips_profit >= 0)
{
color_of_pipsprofit = Lime;
}
else {color_of_pipsprofit = Red;
}
ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);
ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);
ObjectSet("pips_profit", OBJPROP_CORNER, 3);
ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);
ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);
}I created this coding, but I cannot isolate the profits of one currency from other currencies being traded. What am I lacking in my code??
Please review. Thanks for your help!
Dave试试这个代码。
{
int total = OrdersTotal();
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)
{
Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());
}
}
return(0);
}
double Profit(int type, string currency, double open)
{
if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy
if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy
return(-1);
}嗨,编码员。
这并不是我所需要的。 我附上一张图片来说明我所寻找的东西。 你能修改编码以显示利润吗? 如果可以的话,我可以让颜色根据利润额变化。 我只是在寻找每种特定货币的利润。
附带的指标
嗨,Codersguru
我希望所附的指标能在格林威治时间的午夜显示开盘,而不是经纪人的服务器时间,这可能吗?
感谢Monty
对代码的帮助
你能解释一下代码吗? 我得到一个不正确的值(见下面的 "账户"),然后它被正确地填充,但我不确定为什么。
int Account = 123456;
if (Account != AccountNumber())
{
Comment("你不能用这个账户来使用这个程序")。
返回(0)。
}
否则
{
Comment("Welcome to Program");
}
简单的问题
如果没有init()和deinit()函数,专家顾问能否正常运行?
如果没有init()和deinit()函数,专家顾问能否正常运行?
是的。
只需要启动函数。
卡伦佐。
我有一个问题。
HEDGING。
我在寻找
如果(OrderOpenPrice() = = Bid (或Ask)
开仓价格 必须与新价格相等。
我用相同的货币对EURUSD进行套期保值。
如果开盘价是卖出,价格是1.3580。
买入价格必须是相同的。
谢谢。以下是代码。
B.
//------------------------------------------
if(Buy==0)
{
RefreshRates()。
OrderSend(Symbol_1,OP_BUY,lotsi,MarketInfo(Symbol_1,MODE_ASK),...
RefreshRates()。
如果(OrderOpenPrice() == Bid)
{
OrderSend(Symbol_1,OP_SELL,lotsi,MarketInfo(Symbol _1,MODE_BID),。
}