[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 119
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Outputs 2 errors
'clOpenBuy' - variable not defined .mq4 (40, 49)
clOpenBuy - variable not defined
I rewrote the code again and it fails to correct these 2 errors.
alex12, I don't understand you. You have a few jobs in kodobase and you ask such questions. You've already covered several threads with them.
The clOpenBuy variable isn't defined. So it must be defined. Judging by the code, it is something similar to the colour associated with the opening of a buy order.
How the variable is defined, you should know exactly. Since it is used in several different functions, it should probably be global. So define it as global. And all the more so because
color clCloseBuy;
You have defined it.
It generates a lot of errors
Sorry, alex12, but you look like a bulldozer (no offence, that's an accepted term). You make something out of different pieces and somehow get it to compile, but you don't understand the meaning of the code.
Contact the Jobs service.
It generates a lot of errors
...
OrderOpenTime() shows the time when the position was opened, my question is how do I know the time when the STOP order was set?
The MT4 report has this time, but is it possible to find it out from the code?
Once again.
Go through all of your stop orders in a "standard" cycle, and for yourself, unprint the value of the OrderOpenTime() for them - this must be the time at which they (each of them) were set. Here is an example for market orders - adjust it a bit, i.e., or remove this line altogether
if ((orderType != OP_BUY) && (orderType != OP_SELL)) continue;
or replace it with data from the stop orders you are interested in...
Once again.
Go through all of your stop orders in a "standard" loop, and for yourself, unprint the value of OrderOpenTime() for them - this must be the time at which they (each of them) are set. Here is an example for market orders - adjust it a bit, i.e., or remove this line altogether
if ((orderType != OP_BUY) && (orderType != OP_SELL)) continue;
or replace it with data from stop orders you are interested in...
But for STOP orders that have already been closed, OrderOpenTime() returns the time of position opening, not the time when the order was placed.
As a result, it all comes down to this: Is it possible to retrieve the time that the STOP orders from the list of OrdersHistoryTotal(), when they were established?
This is where I ran into a dilemma - I need the STOP order opening time for some "statistics" and I wouldn't want this process to run all the time, but only at a certain final stage. For this reason, we do not need to search for the orders opened at that moment (OrdersTotal()), but to search among the orders already closed => OrdersHistoryTotal().
But for STOP orders that have already been closed, OrderOpenTime() returns the time of position opening, not the time when the order was placed.
As a result, it all comes down to this: Is it possible to retrieve the time that the STOP orders from the list of OrdersHistoryTotal(), when they were established?
Yes... The challenge... I DON'T KNOW. Looks like you can't - especially in the "final stages"...
You have to constantly monitor this process and keep track of it - see the FAQ post on the previous page.
Yes... The challenge... I DON'T KNOW. Looks like you can't - especially in the "final stages"...
You have to constantly monitor this process and keep track - see the FAQ post on the previous page.
Thanks anyway!
In that case, it's easier to write to a file, less hassle, and the statistics can be organised as you need them, not the terminal.