You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
"OrderSelect()" return and integer, when the documentation clearly states that it returns a Boolean?
boolean is 0 or 1
You don't even check the result of the "OrderClose()" or if an run-time error occurred! ill write the code after i understand order select FMIC
c programming is important to understand. happy?
"OrderSelect()" return and integer, when the documentation clearly states that it returns a Boolean?
boolean is 0 or 1
You don't even check the result of the "OrderClose()" or if an run-time error occurred! yes but that comes after FMIC
It is already a Boolean, you don't need to compare it with anything, be that another Boolean constant or a typecast Integer. You should not hard-code internal represented Boolean values! You should use "true" or "false", but ideally only when initializing a variable, not in comparisons.
Had you bothered to learn "C", you would have known this!
this is my question
what switches order select function from false to true?
i understand ! equals not
examples
if not order select or if order select BUT
by default order select is 0 so what switches order select from 0 to 1?
documentation reads
"Returned value
It returns true if the function succeeds,"
thats not enough information for me to understand
thank you FMIC
just this forum
eddie do you know anything about order select function?
Of course i know.
I have learned from other coders and i'm able to read the MQL books and manuals.
But the most important point is: i have learned to use the debugger. It saved me a lot of time searching for MY analytical an codeing mistakes.
If you understand, why did you not do it correctly in the first place!
boopa26: this is my question
what switches order select function from false to true?
examples
if not order select or if order select BUT
by default order select is 0 so what switches order select from 0 to 1?
documentation reads
"Returned value It returns true if the functionsucceeds,"
thats not enough information for me to understandThere is no "default" nor does it switch from one value to another! It either succeeds in selecting the order and returns "true"; or it fails, returning "false" and you have to check the Error code to find out why!
1. does not need c knowledge. mql4 is different functions
3. read documentation already4. written code already
Please do not feed the troll. When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.
hello i can cycle order select to find open orders but i cannot cycle order select to find closed order profits. example i want to find last closed order profit
this code cycles order select to find open orders
//cycle order select
if(OrdersTotal()>0&&
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
//close open order
if(OrdersTotal()>0&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==1&&
OrderMagicNumber()==magic_number&&
OrderType()==OP_BUY&&
// close order signal)
OrderClose(OrderTicket(),lots_2,Bid,3,Blue);
https://docs.mql4.com/trading/orderselect
https://docs.mql4.com/trading/orderprofit
maybe this
b<OrdersHistoryTotal()&&
OrderSelect(b,SELECT_BY_POS,MODE_HISTORY)==0)
b++;
//cycle order select
if(OrdersTotal()>0&&
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
//close open order
if(OrdersTotal()>0&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==1&&
OrderMagicNumber()==magic_number&&
OrderType()==OP_BUY&&
// close order signal)
OrderClose(OrderTicket(),lots_2,Bid,3,Blue);
yiu do not initialize variable a and why is it static?
You have already been told that you should use true or false, not 1 or 0
// OR
!OrderSelect(a,SELECT_BY_POS,MODE_TRADES))
You are not cycling through the orders
//cycle order select
if(OrdersTotal()>0&&
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
//close open order
if(OrdersTotal()>0&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==1&&
OrderMagicNumber()==magic_number&&
OrderType()==OP_BUY&&
// close order signal)
OrderClose(OrderTicket(),lots_2,Bid,3,Blue);
yiu do not initialize variable a and why is it static?
You have already been told that you should use true or false, not 1 or 0
// OR
!OrderSelect(a,SELECT_BY_POS,MODE_TRADES))
You are not cycling through the orders
static int a; sits above start(){ GLOBAL VALUE
theres no difference 1 or 0. true or false
i am increasing value a after conditions take effect