trade limitation - page 2

 

sorry, this is my mistake i should delete the !

i should be more careful

int lastorder = OrdersHistoryTotal()-1;
   {
   OrderSelect(lastorder,SELECT_BY_POS,MODE_HISTORY);
   while(OrderCloseTime() < Period())
   enableopen=false;

 can anyone explain the code for me

my logic is like this

whenever the time is greater than orderclosetime by 10 bar, then enableopen = true, if not enableopen =false, this is constantly tested for each bar

 

and according to the code above, can anyone explain what have i wrote and how to change it to what i want?  

 
shenlongming:


 and according to the code above, can anyone explain what have i wrote and how to change it to what i want?  

Yes but I won't . . .  if you want someone to write your code for you then go here:  MT4 & MT5 coding

 

If you want to learn then answer some questions: 

  • why did you use a while instead of an if ?
  • what type of variable does OrderCloseTime() return ?
  • what type of variable does Period() return ?

 

ya, i'll use the if function

just now cant see clearly

good question though

why i dont think of it just now, i still need to learn a lot.thx a lot, no more question for now 

Reason: