Declare a 2-dim. integer array with error number and e.g. minute of the day:
(#define MoD(t) ((int)(((TimeCurrent())%86400)/60)) // Minute of Day 00:00=(int)0 .. 23:59=1439
and check and make sure that the error wasn't printed to the log some n minutes before.
if n = 30 (minutes) you'll get 48 entries per day.
THANKS
The idea is interesting.
I'm going to try to code this
The idea is interesting.
I'm going to try to code this
Good evening
Based on the proposed idea, I made my code.
Here's the general outline, if it helps others.
I didn't need to call the macro. I actually understand what it does, but I don't see how to use it.
The idea of my code is to create an error buffer.
It is an array of structures.
Each time a message must be generated, the code calls a function which will write to this error buffer.
To use the same example lines this gives
You need one more function to purge elements that have more than 30 minutes in this buffer
This function (PurgeErrorBuffer) is launched directly from the write function (isErrorPresent)
It works for me, there are certainly other ways to do it, at least one with the macro lol
Based on the proposed idea, I made my code.
Here's the general outline, if it helps others.
I didn't need to call the macro. I actually understand what it does, but I don't see how to use it.
The idea of my code is to create an error buffer.
It is an array of structures.
struct g_StructErrorM30 { datetime ErrorTime; int ErrorNumber; string ErrorMessage; }; g_StructErrorM30 g_ErrorM30[];
Each time a message must be generated, the code calls a function which will write to this error buffer.
To use the same example lines this gives
if ( ! SetIndexBuffer ( g_indexiMA, g_BufferMA, INDICATOR_DATA )) { isErrorPresent( g_ErrorM30, GetLastError (), "Error %d: Failed to set index buffer for g_BufferMA"); return ( INIT_FAILED ); } if ( ! SetIndexBuffer ( g_indexiMATrend, g_BufferMATrend, INDICATOR_COLOR_INDEX )) { isErrorPresent( g_ErrorM30, GetLastError (), "Error %d: Failed to set index buffer for g_BufferMATrend"); return ( INIT_FAILED );
You need one more function to purge elements that have more than 30 minutes in this buffer
This function (PurgeErrorBuffer) is launched directly from the write function (isErrorPresent)
It works for me, there are certainly other ways to do it, at least one with the macro lol

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
Happy holidays to everyone.
I wonder.
I like codes that have error handling to easily track any issues, to track whether step-by-step validations are valid.
Example
At the beginning, as said in the title, I put g_debug in define.
It's up to me to compile with the correct hard value in the code.
This allows me to have a development version and a production version.
The problem is that in the event of a problem, a poor internet connection, a problem with communication between the server and the terminal, can very quickly generate very large logs that are completely useless in the context of production code.
On the other hand, to follow a code that does not work for a client, it would be useful to have an error message, and therefore a way to resolve the problem.
it would then be simple to ask to put the code in debug mode through an input and then to take the actions which trigger the problem observed.
I need your feedback on this.
Is offering degug as input a good or bad idea?
THANKS