expert advisor - miscellaneous questions - page 40

 
Max Enrik:


No, I need to close all chart symbol orders.
Yes, with correct magicnumber.

if(closeallsymbols==false && OrderSymbol()!=Symbol()) 
This is a bit weird.
 
Marco vd Heijden:
This is a bit weird.

Yeah!
Same here! That I was thought this part of close order function so weird but it works.

 
What part of "You must RefreshRates after sleep and between multiple server calls if you want to use the Predefined Variables (Bid/Ask) or before OrderSelect to use OrderClosePrice() instead." was unclear?
 
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
  • docs.mql4.com
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
 

Sorry please do not blame me. Still confusing.
I need to ask something, and need to do it step by step cause lack of my code knowledge.

Q1:  Could I use while()?
Q2:  Could I use sleep()?
Q3:  Could RefreshRates() solve my issue? ( is that last thing that I solve my issue, please? )

Please, let me know about that, because I do not want to hurt my close order function.

 

You could use while but then you need also add a counter that breaks out of the loop after X number of tries otherwise you risk the expert to get stuck in an enless loop.

And you spak of your issue but i have no idea what is the issue.

If your issue is about the close price then you can just use,

MarketInfo(OrderSymbol(),MODE_ASK);
MarketInfo(OrderSymbol(),MODE_BID);

Respectively and add the OrderType() switch for OP_BUY and OP_SELL.

 
Marco vd Heijden:

And you spak of your issue but i have no idea what is the issue.

I just need to say my issue is: sometimes my Close Open Orders function left some open orders. I want to close all my open orders at once all the time.

---

2nd time edited

Could I replace all of my Bid and Ask functions to MarketInfo(), please?

MarketInfo(OrderSymbol(),MODE_BID);
MarketInfo(OrderSymbol(),MODE_ASK);
 
whroeder1:
What part of "You must RefreshRates after sleep and between multiple server calls if you want to use the Predefined Variables (Bid/Ask) or before OrderSelect to use OrderClosePrice() instead." was unclear?


RefreshRates() I do not understand where could I put it.

Thanks for your comments.

 
Max Enrik:

I just need to say my issue is: sometimes my Close Open Orders function left open open orders. I want to close all my open orders at once all the time.

---

2nd time edited

Could I replace all of my Bid and Ask functions to MarketInfo(), please?

Yes if you are handling a position that is not the chart symbol.
 
Marco vd Heijden:
Yes if you are handling a position that is not the chart symbol.


Thanks a lot I will replace all of them, so let's see what happen on Monday.

Have a nice weekend.

Reason: