1. There are some buy orders are opened and one buy pending order is placed. all orders are in same currency pair. how an EA will select only last opened order to check its stop limits?
2. every opened order was placed at different prices with tp 20. is it possible for ea to to modify all opened orders except the last one, and change their stop limits to the stop limits of last opened order?
EXAMPLE:
Sr type price tp
1 buy 1.239501.23750
------------------------------
# buylimit 1.237501.23550//////////////////////////////1 buy 1.239501.23550// tp modified and now equal to 2nd tp2 buy 1.237501.23550// 2nd tp
------------------------------
# buylimit 1.235501.23350//////////////////////////////1 buy 1.239501.23350// tp modified and now equal to 3rd tp2 buy 1.237501.23350// tp modified and now equal to 3rd tp3 buy 1.235501.23350// 3rd tp
------------------------------
# buylimit 1.233501.23150
Now new editor accepts both, but... which one will work the same like the highlighted line? if both true, then which one should i use? (more convenient?)
PS: Below code is also accepted by new editor...
if((SignalS & AAA) !=0)
New editor accepts all three, but... which one will work the same like the highlighted line? if all true, then which one will be more convenient for me?
qgmql: New editor accepts all three, but... which one will work the same like the highlighted line? if all true, then which one will be more convenientfor me?
On prior builds bitwise and was higher than multiplication
Operation
Desciption
Execution Order
()
[]
.
Function Call
Referencing to an array element
Referencing to a structure element
From left to right
!
~
++
--
(type)
sizeof
Logical negation
Bitwise negation (complement)
Sign changing
Increment by one
Decrement by one
Typecasting
Determining size in bytes
Right to left
*
/
%
Multiplication
Division
Module division
From left to right
+
Addition
Subtraction
From left to right
<<
>>
Left shift
Right shift
From left to right
<
<=
>
>=
Less than
Less than or equal
Greater than
Greater than or equal
From left to right
==
!=
Equal
Not equal
From left to right
&
Bitwise AND operation
From left to right
^
Bitwise exclusive OR
From left to right
|
Bitwise OR operation
From left to right
&&
Logical AND operation
From left to right
||
Logical OR operation
From left to right
?:
Conditional Operator
Right to left
=
*=
/=
%=
+=
-=
<<=
>>=
&=
^=
|=
Assignment
Multiplication with assignment
Division with assignment
Module with assignment
Addition with assignment
Subtraction with assignment
Left shift with assignment
Right shift with assignment
Bitwise AND with assignment
Exclusive OR with assignment
Bitwise OR with assignment
Right to left
,
Comma
From left to right
() Function call From left to right
[] Referencing to an array element
! Logical negation From right to left
- Sign changing operation
++ Increment
-- Decrement
~ Bitwise negation (complement)
&Bitwise operation AND From left to right
| Bitwise operation OR
^ Bitwise operation exclusive OR
<< Left shift
>> Right shift
* Multiplication From left to right
/ Division
% Module division
+ Addition From left to right
- Subtraction
< Less than From left to right
<= Less than or equal
> Greater than
>= Greater than or equal
== Equal
!=Not equal
|| Logical OR From left to right
&& Logical AND From left to right
= Assignment From right to left
+= Assignment addition
-= Assignment subtraction
*= Assignment multiplication
/= Assignment division
%= Assignment module
>>= Assignment right shift
<<= Assignment left shift
&= Assignment bitwise AND
|= Assignment bitwise OR
^= Assignment exclusive OR
WHRoederi found your code (select last market order) and added highlighted lines to check its tp price and to set the same tp price on previous orders:
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
(All market+pending orders type is only buy, not sell or only sell, not buy and i want the tp of all market orders to be changed every time, when new market order is opened).
THIS IS REALLY TOUGH FOR ME, BUT I WANT TO DO IT. :(
Things are getting complicated for me. I think i should write code from start. and i will paste each part of code here. maybe i could understand that better.
Is this code ok? if not then please write some code instead of link, i am still confused.
NO https://www.mql5.com/en/forum/133792/page3#550831
gives pipvalue for a lot traded on specific symbol
1. There are some buy orders are opened and one buy pending order is placed. all orders are in same currency pair. how an EA will select only last opened order to check its stop limits?
2. every opened order was placed at different prices with tp 20. is it possible for ea to to modify all opened orders except the last one, and change their stop limits to the stop limits of last opened order?
EXAMPLE:
Some confusion with...
Old editor accepts the highlighted lines, but new editor gives warning "Expression not boolean"
I tried then...
Now new editor accepts both, but... which one will work the same like the highlighted line? if both true, then which one should i use? (more convenient?)
PS: Below code is also accepted by new editor...
New editor accepts all three, but... which one will work the same like the highlighted line? if all true, then which one will be more convenient for me?
(SignalS & AAA) !=0Operation
Desciption
Execution Order
()
[]
.
Function Call
Referencing to an array element
Referencing to a structure element
From left to right
!
~
++
--
(type)
sizeof
Logical negation
Bitwise negation (complement)
Sign changing
Increment by one
Decrement by one
Typecasting
Determining size in bytes
Right to left
*
/
%
Multiplication
Division
Module division
From left to right
+
Addition
Subtraction
From left to right
<<
>>
Left shift
Right shift
From left to right
<
<=
>
>=
Less than
Less than or equal
Greater than
Greater than or equal
From left to right
==
!=
Equal
Not equal
From left to right
&
Bitwise AND operation
From left to right
^
Bitwise exclusive OR
From left to right
|
Bitwise OR operation
From left to right
&&
Logical AND operation
From left to right
||
Logical OR operation
From left to right
?:
Conditional Operator
Right to left
=
*=
/=
%=
+=
-=
<<=
>>=
&=
^=
|=
Assignment
Multiplication with assignment
Division with assignment
Module with assignment
Addition with assignment
Subtraction with assignment
Left shift with assignment
Right shift with assignment
Bitwise AND with assignment
Exclusive OR with assignment
Bitwise OR with assignment
Right to left
,
Comma
From left to right
WHRoeder i found your code (select last market order) and added highlighted lines to check its tp price and to set the same tp price on previous orders:
An extra line...
Please guide, if i am wrong.
(All market+pending orders type is only buy, not sell or only sell, not buy and i want the tp of all market orders to be changed every time, when new market order is opened).
THIS IS REALLY TOUGH FOR ME, BUT I WANT TO DO IT. :(