Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 478

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
There isFileSeek(File,0,SEEK_END); and everything is written to the file from a new line.
The problem is that there are 4 files and we need to write data on four positions, each in a separate file, each file has a position ticket in the name, but the data are written only to one, the last file, the data on the last position.
Are the file names formed correctly? Instead of Ticket=OrderTicket(); File name=_Ticket+Symbol()+".txt"; I would write File name=(string)OrderTicket()+Symbol()+".txt"; and add #property strict directive in the beginning - helps eliminate errors
Thank you, the name formation was redone according to your recommendation, but it still writes only the data of the last position.
And, the names of new files haven't changed) I suspect it's not the name, the file of the last position was found anyway.
Why does it ignore the previous positions?
1501896125EURUSD.txt
Time Half BID Price
2018.02.22 22:53 P 1,23259 0,88322
2018.02.22 22:54 P 1,23259 0,88322
2018.02.22 22:55 P 1,23259 0,88322
2018.02.22 22:56 P 1,23249 0,88322
1501896094EURUSD.txt
Time Half BID Price
2018.02.22 22:43 L 1,23212 1,23203
2018.02.22 22:44 L 1,23220 1,23203
2018.02.22 22:44 L 1,23224 1,23203
2018.02.22 22:45 L 1,23244 1,23203
2018.02.22 22:45 L 1,23242 1,23203
2018.02.22 22:46 L 1,23251 1,23203
changed something? see ... this: string sy=""; int op=-1, mn=-1; hardly needed ... can we drop it? In the loop instead of nested if() it's better to continue;
1501896125EURUSD.txt
Time Half BID Price
2018.02.22.02.22 22:53 P 1,23259 0,88322
2018.02.22 22:54 P 1,23259 0,88322
2018.02.22 22:55 P 1,23259 0,88322
2018.02.22 22:56 P 1,23249 0,88322
1501896094EURUSD.txt
Time Half BID Price
2018.02.22:43 L 1,23212 1,23203
2018.02.22 22:44 L 1,23220 1,23203
2018.02.22 22:44 L 1,23224 1,23203
2018.02.22 22:45 L 1,23244 1,23203
2018.02.02.22 22:45 L 1,23242 1,23203
2018.02.22 22:46 L 1,23251 1,23203
change anything? see...this: string sy=""; int op=-1, mn=-1; hardly needed ... can we drop it? In the loop instead of nested if() it's better to continue;
It doesn't want to write over all the positions.
There are 7 positions open. I have written one file.
I have compiled it when it was on a charts and it has started to write the data of the first and the last positions. Now I have only one data, from the first position.
I can't see six, but I have all ticks inAlert(NameFile).
What does it need...
if(t_pre+60<TimeCurrent() && _o_t+1800>TimeCurrent()) // once every half an hour from the order opening. Is this necessary?
{
t_pre=TimeCurrent();
The program contains ramifications:
What was the purpose of writing it in a staircase before? In the old version of MQL4 it sped up execution. It is of no importance now
The variable _o_t is used only in 2 places. If we replace it with OrderOpenTime(), the program becomes clearer and shorter in 2 lines (declaration and assignment)
datetime _o_t; and
_o_t=OrderOpenTime();
I've got it - the 60-second countdown has to be taken out of the loop
Good afternoon, dear forum users.
Can you tell me why the optimization and testing of the same settings sometimes produce different results?
I downloaded quotes from SQ Tick Downloader and ran them through the script
Good afternoon, dear friends.
Can you tell me why the optimization and testing of the same settings sometimes produce different results?
I'll tell you more: when trading on a real account with the same broker on 2 different accounts, there can be different results.
It probably depends more on the broker. But could you give me a hint on the initial question?
It probably depends more on the broker. But could you give some advice on the initial question?