Is it correct ?
I tried to select one order everyday .
OrdersTotal()-1
OrdersTotal()-1
Why the minus 1?
for(int i=0;i<OrdersTotal();i++)
is correct
Why the minus 1?
is correct
it still open more trades .
Is it correct ?
I tried to select one order everyday .
Need more info what do you mean by select one order everyday ?
Need more info what do you mean by select one order everyday ?
I wanted to allow one order each day only .
datetime time;
if(time!=iTime(Symbol(),PERIOD_D1,0)) { if(OrderSelect(0, SELECT_BY_POS, MODE_TRADES)) { Print(TimeToString(time)+" Selected OrderTicket: "+(string)OrderTicket()); } time=iTime(Symbol(),PERIOD_D1,0); }
OrdersTotal()-1
Why the minus 1?
is correct
it still open more trades .
I was replying to Marius's post.
- Why did you post your MT4 question in the Root / MT5 General
section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. -
iTime(Symbol(),PERIOD_D1,0)
On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing candle values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero on the first call.
-
or just compute current date
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 programming forum - Minus one (p=n-1) if you are counting down. (p < n) if you are counting up. Either are OK in this case.
- Marco vd Heijden:Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
if(OrderSelect(0, SELECT_BY_POS, MODE_TRADES))
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
-
- Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your
code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
if(time!=iTime(Symbol(),PERIOD_D1,0)) { if(OrderSelect(0, SELECT_BY_POS, MODE_TRADES)) { Print(TimeToString(time)+" Selected OrderTicket: "+(string)OrderTicket()); } time=iTime(Symbol(),PERIOD_D1,0); }
This code prints a Order Ticketnumber.
Explain to me how this can possibly harm other EA's and or Other EA's running (other) Magic Numbers.
This code isn't incompatible, in fact is is compatible to every other EA(including itself on other charts and manual trading.)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is it correct ?
I tried to select one order everyday .