int PositionIndex; // <-- this variable is the index used for the loopint TotalNumberOfOrders; // <-- this variable will hold the number of orders currently in the Trade pooldouble Ord_TP=0;
TotalNumberOfOrders = OrdersTotal(); // <-- we store the number of Orders in the variablefor(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --) // <-- for loop to loop through all Orders . . COUNT DOWN TO ZERO !
{
if( ! OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES) ) continue; // <-- if the OrderSelect fails advance the loop to the next PositionIndexif( OrderMagicNumber() == MagicNo // <-- does the Order's Magic Number match our EA's magic number ?
&& OrderSymbol() == Symbol() // <-- does the Order's Symbol match the Symbol our EA is working on ?
&& ( OrderType() == OP_BUY// <-- is the Order a Buy Order ?
|| OrderType() == OP_SELL ) ) // <-- or is it a Sell Order ?if(OrderTakeProfit()>0)Ord_TP = OrderTakeProfit(); break;if(OrderTakeProfit() == Ord_TP) continue;OrderModify(OrderTicket(),0,0,Ord_TP,0,CLR_NONE);//if ( ! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage ) ) // <-- try to close the order//Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError() ); // <-- if the Order Close failed print some helpful information
} // end of For loop
这段代码可以吗?如果不可以,请写一些代码而不是链接,我还是很困惑。
没有https://www.mql5.com/en/forum/133792/page3#550831
给出在特定符号上交易的手数的点值
1.有一些买入订单被打开,一个买入挂单被放置。所有订单都是同一货币对。
2.每一个开仓的订单都是以不同的价格下的,tp20。EA是否可以修改所有开仓的订单,除了最后一个,并将其止损点改为最后一个开仓订单的止损点?
例子。
一些混乱的情况...
旧的编辑器接受突出显示的行,但新的编辑器给出警告 "表达式不是布尔值"
我试了一下...
现在,新的编辑器同时接受这三个代码,但是......哪一个会像突出显示的那一行一样工作呢?(更方便吗?)
PS:下面的代码也被新的编辑器所接受...
新的编辑器接受所有三个,但是......哪一个会像高亮线一样工作? 如果都是真的,那么哪一个对我来说更方便 ?
(SignalS & AAA) !=0
操作
描述
执行顺序
()
[]
.
函数调用
引用一个数组元素
对结构元素的引用
从左到右
!
~
++
--
(类型)
sizeof
逻辑上的否定
位数否定(补码)
符号变化
增一
递减1
类型转换
确定字节的大小
从右到左
*
/
%
乘法
除法
模块除法
从左到右
+
加法
减法
从左到右
<<
>>
左移
右移
从左到右
<
<=
>
>=
小于
小于或等于
大于
大于或等于
从左到右
==
!=
等于
不等于
从左到右
&
Bitwise AND操作
从左到右
^
位数排他性OR
从左到右
|
位数OR操作
从左到右
&&
逻辑与操作
从左到右
||
逻辑OR操作
从左到右
?:
条件性操作符
从右到左
=
*=
/=
%=
+=
-=
<<=
>>=
&=
^=
|=
赋值
带赋值的乘法
有赋值的除法
有赋值的模块
有任务的加法
有赋值的减法
赋值左移
赋值右移
赋值的位数和
赋值的排他性OR
赋值的位数OR
从右到左
,
逗号
从左到右
WHRoeder 我找到了你的代码(选择最后的市场订单),并添加了高亮线来检查它的TP价格,并在以前的订单上设置相同的TP价格。
一个额外的行...
如果我说错了,请指导。
(所有的市场+挂单类型都是只买 不卖,或者只卖 不买,我希望每次新的市场订单 打开时,所有市场订单 的tp都能改变)。
这对我来说真的很困难,但我想这样做。