问吧! - 页 129 1...122123124125126127128129130131132133134135136...182 新评论 Goen_FX 2008.09.02 21:21 #1281 forexarchitect: 大家好我有一个问题......我如何改变以下内容。 extern double MaxLot = 1.50; double max_lot = GetMaxLot(OP_BUY, OP_SELL); if (max_lot >= MaxLot) lot = CalcHedgeLot(order_type); (order_type)]。", lot)。 如果(lot == -1)返回(lot)。 lot = NormalizeDouble(lot, LotPrec); 如果(lot > MaxLot) lot = MaxLot; 如果(lot < MinLot)lot = MinLot。 返回(lot)。 } 以上是对OP_BUY和 OP_SELL的检查。 问题:我如何把它改为任何OP_BUY或 任何OP_SELL? 欣赏 你必须修改GetMaxLot()函数 的代码,或者你可以使用GetMaxLot(OP_BUY, OP_BUY);和GetMaxLot(OP_SELL, OP_SELL);(取决于代码 - 可以这样做或不这样做)。 但我想这值得一试 签名 Sadly 2008.09.02 21:40 #1282 Goen: 这就是你要找的东西吗?----------- int bars_count=WindowBarsPerChart(); int bar=WindowFirstVisibleBar()。 ----------- Goen 谢谢你,Goen . [删除] 2008.09.03 03:03 #1283 Goen: 你必须修改GetMaxLot()函数的代码,也许你可以使用GetMaxLot(OP_BUY, OP_BUY);和GetMaxLot(OP_SELL, OP_SELL);(取决于代码 - 可以这样做,也可以不这样做)。但我想这值得一试 签名 谢谢你的回答。 我需要在这里做什么改动? double GetMaxLot(int type1, int type2) { double max_lot = 0.0; int cnt = OrdersTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 继续。 如果(OrderSymbol() != Symbol())继续。 如果(OrderMagicNumber() != Magic)继续。 如果(OrderType() != type1 && OrderType() != type2)继续。 如果(max_lot == 0 || OrderLots() >= max_lot) { max_lot = OrderLots()。 } } 返回(max_lot)。 } Ask! 新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 [警告关闭!]任何新手问题,为了不给论坛添乱。专业人士,不要走过。没有你,哪里都不能去。 [删除] 2008.09.03 03:07 #1284 有点不知所措... yarksiew 2008.09.03 03:27 #1285 如何在TIS指标上添加警报? 我有一个MA交叉指标,工作得非常好,但它没有声音警报支持,使我错过了很多交易,你能不能教我如何添加警报到这个指标,因为我对元代码的事情一无所知....thanks... 以下是该指标的代码和指标本身,谢谢... /*[[ 名称 := EMA交叉 作者 := Hapsa 链接 :=http://www.metaquotes.net/ 分离窗口 := 否 分离窗口 := 无 第一颜色 := 红色 第一绘图类型 := 符号 第一个符号 :=108 使用第二数据 := 是 第二颜色 := 深橄榄绿 第二绘图类型 := 符号 第二符号 :=108 ]]*/ #财产版权 "Hapsa" #属性链接"" Extern int SlowPeriod=20; extern int FastPeriod=5; #属性 indicator_buffers 3 #属性 indicator_chart_window #属性 indicator_color1 红色 #属性 indicator_color2 绿色 double L20[]; 双倍L50[]。 double shift=0,val1=0,val2=0。 int init() { IndicatorBuffers(3); SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(0, 108); SetIndexArrow(1, 108); SetIndexBuffer(0,L20); SetIndexBuffer(1,L50); //---- 指标 //---- return(0); } int start() { int counted_bars=IndicatorCounted()。 //---- int i = Bars - counted_bars - 1; while (i>=0) { val1=0。 val2=0。 double iMaSlowPrevious = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE, i-1); double iMaSlowCurrent = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE,i); double iMaFastPrevious = iMA(NULL,0,FastPeriod,0,MODE_EMA,PRICE_CLOSE,i-1); double iMaFastCurrent = iMA(NULL,0,FastPeriod,0,MODE_EMA,PRICE_CLOSE,i); 如果(iMaFastPreviousiMaSlowCurrent ) val1=高。 如果(iMaFastPrevious>iMaSlowPrevious && iMaFastCurrent<iMaSlowCurrent ) val2=Low。 L20=val1+5*Point。 L50=val2-5*Point。 i--; } //---- return(0); } 附加的文件: cross.mq4 2 kb cross.ex4 3 kb Ask! 如何编码? 编码帮助 Goen_FX 2008.09.03 18:28 #1286 forexarchitect: 谢谢你的回答。我需要在这里修改什么? 感谢你的帮助 double GetMaxLot(int type1, int type2) { double max_lot = 0.0; int cnt = OrdersTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 继续。 如果(OrderSymbol() != Symbol())继续。 如果(OrderMagicNumber() != Magic)继续。 如果(OrderType() != type1 && OrderType() != type2)继续。 如果(max_lot == 0 || OrderLots() >= max_lot) { max_lot = OrderLots()。 } } 返回(max_lot)。 } 是的,你可以使用GetMaxLot(OP_BUY,OP_BUY);来获得买入开仓交易的最大lot,而GetMaxLot(OP_SELL,OP_SELL);来获得卖出开仓交易的最大lot。 你可以用 "if (OrderLots() >= max_lot) "来简化这段代码 "if (Max_lot == 0 || OrderLots() >= max_lot)" 因为如果max_lot=0,它将自动低于任何未平仓交易的手数。符号">="改为">",因为如果它有相同的值,就没有必要用相同的值来更新max_lot,这是无用功。只有当新的值大于max_lot时,它才会更新。 通过改变这段代码,它可以使你的程序更快。 签名 azirtyken 2008.09.10 22:15 #1287 止损问题 你好。 我是外汇/金属交易的新手,但正在努力了解它是如何运作的。 现在我正试图编写一个EA,但我担心我错过了一些基本的东西。 如果在我的代码中,我把 OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,",MAGIC,0,Red)。 与 OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Ask+Point*10,0,"",MAGIC,0,Red)。 在策略测试器中测试这个新版本,我得到了更少的订单。增加止损怎么会减少订单的数量?我可以想象,在增加止损单导致订单更早退出,从而可以更快地增加新的订单的情况下,数量会增加,但是减少订单...? 有什么想法吗? 谢谢 omelette 2008.09.10 22:18 #1288 azertyken2: 你好。我是所有这些外汇/金属交易的新手,但正在努力了解这一切是如何运作的。 现在我正试图编写一个EA,但我担心我错过了一些基本的东西。 如果在我的代码中,我把 OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,",ordercount,0,Red)。 改为 OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Ask+Point*10,0,"",ordercount,0,Red)。 在策略测试器中测试这个新版本,我得到了更少的订单。增加止损怎么会减少订单的数量?我可以想象,在增加止损单导致订单更早退出,从而可以更快地增加新的订单的情况下,数量会增加,但是减少的订单...? 有什么想法吗? 谢谢 10点可能太接近经纪商规定的止损限制(不同经纪商之间有所不同)--这意味着如果是10点的最小值,而在下单时价格恰好在此范围内波动1点,则订单将被拒绝... azirtyken 2008.09.10 22:41 #1289 煎蛋,你是对的,增加止损后就解决了,谢谢!:-) Dave137 2008.09.11 00:28 #1290 #property indicator_color1 Magenta #property indicator_color2 Yellow extern bool TrendDirectionUp=true; string Color1; string Color2; int init() { if(TrendDirectionUp==true)//Conditionj 1 { Color1=Yellow; Color2=CLR_NONE; } if(TrendDirectionUp==false)//Condition2 { Color1=CLR_NONE; Color2=Magenta; } SetIndexStyle(0,DRAW_ARROW,0,star_size,Color1); SetIndexStyle(1,DRAW_ARROW,0,star_size,Color2); SetIndexArrow(0,172);//333 SetIndexArrow(1,172);//334 SetIndexBuffer(0,b1); SetIndexBuffer(1,b2); return(0); } 现在,颜色1和2在图表上都显示为'黑色'!!。 哪位专家大师能帮助我解决这个问题? 预先感谢! 如何编码? Ask! How to code? 1...122123124125126127128129130131132133134135136...182 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
大家好
我有一个问题......我如何改变以下内容。
extern double MaxLot = 1.50;
double max_lot = GetMaxLot(OP_BUY, OP_SELL);
if (max_lot >= MaxLot) lot = CalcHedgeLot(order_type);
(order_type)]。", lot)。
如果(lot == -1)返回(lot)。
lot = NormalizeDouble(lot, LotPrec);
如果(lot > MaxLot) lot = MaxLot;
如果(lot < MinLot)lot = MinLot。
返回(lot)。
}
以上是对OP_BUY和 OP_SELL的检查。
问题:我如何把它改为任何OP_BUY或 任何OP_SELL?
欣赏你必须修改GetMaxLot()函数 的代码,或者你可以使用GetMaxLot(OP_BUY, OP_BUY);和GetMaxLot(OP_SELL, OP_SELL);(取决于代码 - 可以这样做或不这样做)。
但我想这值得一试
签名
这就是你要找的东西吗?
-----------
int bars_count=WindowBarsPerChart();
int bar=WindowFirstVisibleBar()。
-----------
Goen谢谢你,Goen .
你必须修改GetMaxLot()函数的代码,也许你可以使用GetMaxLot(OP_BUY, OP_BUY);和GetMaxLot(OP_SELL, OP_SELL);(取决于代码 - 可以这样做,也可以不这样做)。
但我想这值得一试
签名谢谢你的回答。
我需要在这里做什么改动?
double GetMaxLot(int type1, int type2)
{
double max_lot = 0.0;
int cnt = OrdersTotal();
for (int i=0; i < cnt; i++)
{
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 继续。
如果(OrderSymbol() != Symbol())继续。
如果(OrderMagicNumber() != Magic)继续。
如果(OrderType() != type1 && OrderType() != type2)继续。
如果(max_lot == 0 || OrderLots() >= max_lot)
{
max_lot = OrderLots()。
}
}
返回(max_lot)。
}
有点不知所措...
如何在TIS指标上添加警报?
我有一个MA交叉指标,工作得非常好,但它没有声音警报支持,使我错过了很多交易,你能不能教我如何添加警报到这个指标,因为我对元代码的事情一无所知....thanks...
以下是该指标的代码和指标本身,谢谢...
/*[[
名称 := EMA交叉
作者 := Hapsa
链接 :=http://www.metaquotes.net/
分离窗口 := 否
分离窗口 := 无
第一颜色 := 红色
第一绘图类型 := 符号
第一个符号 :=108
使用第二数据 := 是
第二颜色 := 深橄榄绿
第二绘图类型 := 符号
第二符号 :=108
]]*/
#财产版权 "Hapsa"
#属性链接""
Extern int SlowPeriod=20;
extern int FastPeriod=5;
#属性 indicator_buffers 3
#属性 indicator_chart_window
#属性 indicator_color1 红色
#属性 indicator_color2 绿色
double L20[];
双倍L50[]。
double shift=0,val1=0,val2=0。
int init()
{
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(0, 108);
SetIndexArrow(1, 108);
SetIndexBuffer(0,L20);
SetIndexBuffer(1,L50);
//---- 指标
//----
return(0);
}
int start()
{
int counted_bars=IndicatorCounted()。
//----
int i = Bars - counted_bars - 1;
while (i>=0)
{
val1=0。
val2=0。
double iMaSlowPrevious = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE, i-1);
double iMaSlowCurrent = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE,i);
double iMaFastPrevious = iMA(NULL,0,FastPeriod,0,MODE_EMA,PRICE_CLOSE,i-1);
double iMaFastCurrent = iMA(NULL,0,FastPeriod,0,MODE_EMA,PRICE_CLOSE,i);
如果(iMaFastPreviousiMaSlowCurrent ) val1=高。
如果(iMaFastPrevious>iMaSlowPrevious && iMaFastCurrent<iMaSlowCurrent ) val2=Low。
L20=val1+5*Point。
L50=val2-5*Point。
i--;
}
//----
return(0);
}
谢谢你的回答。
我需要在这里修改什么? 感谢你的帮助
double GetMaxLot(int type1, int type2)
{
double max_lot = 0.0;
int cnt = OrdersTotal();
for (int i=0; i < cnt; i++)
{
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 继续。
如果(OrderSymbol() != Symbol())继续。
如果(OrderMagicNumber() != Magic)继续。
如果(OrderType() != type1 && OrderType() != type2)继续。
如果(max_lot == 0 || OrderLots() >= max_lot)
{
max_lot = OrderLots()。
}
}
返回(max_lot)。
}是的,你可以使用GetMaxLot(OP_BUY,OP_BUY);来获得买入开仓交易的最大lot,而GetMaxLot(OP_SELL,OP_SELL);来获得卖出开仓交易的最大lot。
你可以用 "if (OrderLots() >= max_lot) "来简化这段代码 "if (Max_lot == 0 || OrderLots() >= max_lot)"
因为如果max_lot=0,它将自动低于任何未平仓交易的手数。符号">="改为">",因为如果它有相同的值,就没有必要用相同的值来更新max_lot,这是无用功。只有当新的值大于max_lot时,它才会更新。
通过改变这段代码,它可以使你的程序更快。
签名
止损问题
你好。
我是外汇/金属交易的新手,但正在努力了解它是如何运作的。
现在我正试图编写一个EA,但我担心我错过了一些基本的东西。
如果在我的代码中,我把
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,",MAGIC,0,Red)。
与
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Ask+Point*10,0,"",MAGIC,0,Red)。
在策略测试器中测试这个新版本,我得到了更少的订单。增加止损怎么会减少订单的数量?我可以想象,在增加止损单导致订单更早退出,从而可以更快地增加新的订单的情况下,数量会增加,但是减少订单...?
有什么想法吗?
谢谢
你好。
我是所有这些外汇/金属交易的新手,但正在努力了解这一切是如何运作的。
现在我正试图编写一个EA,但我担心我错过了一些基本的东西。
如果在我的代码中,我把
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,",ordercount,0,Red)。
改为
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Ask+Point*10,0,"",ordercount,0,Red)。
在策略测试器中测试这个新版本,我得到了更少的订单。增加止损怎么会减少订单的数量?我可以想象,在增加止损单导致订单更早退出,从而可以更快地增加新的订单的情况下,数量会增加,但是减少的订单...?
有什么想法吗?
谢谢10点可能太接近经纪商规定的止损限制(不同经纪商之间有所不同)--这意味着如果是10点的最小值,而在下单时价格恰好在此范围内波动1点,则订单将被拒绝...
煎蛋,你是对的,增加止损后就解决了,谢谢!:-)
#property indicator_color2 Yellow
extern bool TrendDirectionUp=true;
string Color1;
string Color2;
int init() {
if(TrendDirectionUp==true)//Conditionj 1
{
Color1=Yellow;
Color2=CLR_NONE;
}
if(TrendDirectionUp==false)//Condition2
{
Color1=CLR_NONE;
Color2=Magenta;
}
SetIndexStyle(0,DRAW_ARROW,0,star_size,Color1);
SetIndexStyle(1,DRAW_ARROW,0,star_size,Color2);
SetIndexArrow(0,172);//333
SetIndexArrow(1,172);//334
SetIndexBuffer(0,b1);
SetIndexBuffer(1,b2);
return(0);
}现在,颜色1和2在图表上都显示为'黑色'!!。
哪位专家大师能帮助我解决这个问题?
预先感谢!