master_dude: check if a particular order in orderhistory had already been written or not. however, i have not been able to come up with a solution...
Read the file in OnInit(), find the highest ticket number. Only append higher ones.
Could use a bool flag for this, within the portion that you write to the file, set it to false, and do the test WH suggested. If it is higher than the last one you wrote, set that flag true and only write to the file if the flag is true.
WHRoeder:
Read the file in OnInit(), find the highest ticket number. Only append higher ones.
thanks this worked for me. i create a variable called Log_Ticket, which updates at each run of the loop
Read the file in OnInit(), find the highest ticket number. Only append higher ones.
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
good day to you all :)
following code is of a trading log function i have written, which writes a number of variables to a file. its all working good besides it writes each order over and over again by each new run of the loop. now i was kind of suspecting this to happen and wanted to come up with a piece of logic that would check if a particular order in orderhistory had already been written or not. however, i have not been able to come up with a solution... perhaps one of you guys have an idea? you can see i have added a comment for buy and sell orders respectively where i was imagining the code to perform the check.