Counter orders per day - EA MQL4
-
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. - Trader1529: but I don't know how to write itYour code counts current open orders. You should make that a function and return the count.
- If you open all orders and then later start closing, you can just remember the largest count in a static/global
variable. Number closed=largest - current. Reset the count at the start of a new day. Same as new bar test, but using date:
static datetime currentDay=0; datetime previousDay = currentDay; currentDay = date(); bool isNewDay = currentDay != previousDay;
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 programming forum - Otherwise, you will have to go through history and count all orders closed on today's date.
- Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum - Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum - Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required
accounting/tax laws.)
"balance" orders in account history - Day Trading Techniques - MQL4 programming forumBroker History FXCM Commission - <TICKET>
Rollover - <TICKET>>R/O - 1,000 EUR/USD @0.52 #<ticket> N/A OANDA Balance update
Financing
- Do not assume history has only closed orders.
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
Good mornig,
I'm writing an expert advisor that set a counter for the order opened on the current symbol. This is the code.
Now I need to set another counter for the order closed on the current day for the current symbol.
This counter need to reset every day, but I don't know how to write it. Can someone please help me?