Errors, bugs, questions - page 2555

 
TheXpert:
add FILE_SHARE_READ for write handle and FILE_SHARE_WRITE for read handle

Doesn't work, only individually if hung on the chart. Used:

handle_write=FileOpen("checkbox_color.txt",FILE_WRITE|FILE_SHARE_READ|FILE_TXT,';');
handle_read=FileOpen("checkbox_color.txt",FILE_READ|FILE_SHARE_WRITE|FILE_TXT,';');
 
Влад:

Doesn't work, only individually if hung on the chart. Used:

All solved.Used:

handle_write=FileOpen("checkbox_color.txt",FILE_READ|FILE_WRITE|FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_TXT,';');
handle_read=FileOpen("checkbox_color.txt",FILE_READ|FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_TXT,';');
 
A new question has arisen. In the first chart I am changing the variable thanks to the above mentioned indicator. In the second chart, the information is only displayed when the TF changes, not instantly as I would like. How can it be solved? Just updating the chart by pressing PCM does not help.
 

build 2135 is broken at all

#define abort(ANY) do{printf("abort, file=%s,  line=%i", __FILE__, __LINE__); Alert(1/(uint)MathAbs(0));}while(false)

#define  GENERATE_VECTOR_GROWTH_FACTOR 2
#define  GENERATE_VECTOR(NAME, REF)                                         \
   template <typename T>                                                   \
   class NAME                                                              \
   {                                                                       \
      uint sz;                                                             \
   public:                                                                 \
      T a[];                                                               \
      NAME(): sz(0) {}                                                     \
      NAME(uint count): sz(0) {                                            \
         if (ArrayResize(this.a, count) == -1)                             \
            abort(0);                                                      \
         this.sz = count;                                                  \
      }                                                                    \
      uint size()const           {return this.sz;}                         \
      void clear()               {this.sz = 0;}                            \
      void push_back(T REF value) {                                        \
         if (this.sz == ArraySize(this.a)  &&                              \
             ArrayResize(this.a, this.sz*                                  \
                           GENERATE_VECTOR_GROWTH_FACTOR+1) == -1)         \
            abort(0);                                                      \
         this.a[this.sz++] = value;                                        \
      }                                                                    \
      void reserve(uint new_cap) {                                         \
         if ((int)new_cap > ArraySize(this.a))                             \
            ArrayResize(this.a, new_cap);                                  \
      }                                                                    \
      void erase(uint pos) {                                               \
         if ( ! ArrayRemove(this.a, (int)pos, 1) )                         \
            abort(0);                                                      \
         -- this.sz;                                                       \
      }                                                                    \
   };
#define  GENERATE_VECTOR_EMPTY
GENERATE_VECTOR(vector_fund, GENERATE_VECTOR_EMPTY);
GENERATE_VECTOR(vector_ref, const &);
#undef  GENERATE_VECTOR_EMPTY
#undef  GENERATE_VECTOR_GROWTH_FACTOR
#undef  GENERATE_VECTOR

'GENERATE_VECTOR' - unexpected token, probably type is missing?    1_mystd.mqh    74    1

'GENERATE_VECTOR' - unexpected token, probably type is missing? 1_mystd.mqh 75 1

'GENERATE_VECTOR' - variable already defined 1_mystd.mqh 75 1

Compiled for ages, broke in the new build.

 
Vict:

build 2135 is broken.

It's been compiling for ages, it's broken in the new build.

I cheat, it's fine, one of the abortions was called in the form of
abort();

used to eat the compiler, but in the new build it refused, they must have tweaked something (well I don't think I accidentally deleted a zero).

 
I noticed that ME loads 2 cores (26%) of the CPU when compiling, question arises - is it multithreading, then why wouldn't all cores be used for compilation or is it an error in the form of wasteful use of resources?
 
Vict:
I cheat, it's fine, one of the abortions was called in the form of

The compiler used to eat it up, but in the new build it has refused, so they must have tweaked something (well, I don't think I accidentally deleted a zero).

By the way we should ask the developers to introduce a full-time abortion, assert ... Ideally, of course, and exceptions. But at least start small.
 
Alexey Navoykov:
By the way, we must ask developers to introduce an inline abort, abort ... and ideally, of course, exceptions. But at least start with a small one.

Put in a word, if I'm not mistaken, I asked for it in my last MQL cycle, it's been 4 years, but I had to listen to a hullabaloo from literate people, who said they didn't need it, just write it this way... If you want to stopprogram's execution with a critical error of access to OHLC data or indicator... i looked through half of kodobase, yes, some codewriters check these conditions, but the processing is absent, the maximum i see is the output in expert's log, like a problem happened, don't worry, i will continue to work with invalid data on this tick )))

SZY: I'm sore, I need a simple way to stop processing the current tick! - to stop working of the expert, it is possible, but to stop processing of one tick, invent and work it out - I suspect that on the level of the compiler abort() is realized not more difficult than ExpertRemove() - which already exists

ZZZY: the task of writing an EA in MQL without abort() in procedural style is more like an invention than in assembling a code from ready-made subroutines. I suspect that these constant discussions of how to write an indicator that can correctly handle history for another TF will also be easier solved using abort() - I haven't decided on this subject yet

 
Igor Makanu:

Put in a word, if I'm not mistaken, I asked for it four years ago in my last MQL cycle. well, everything is as usual

You're right, when you start saying that, those literate people will come out of all holes, saying "this is not C++").

you need a simple way to stop processing the current tick! - it means it is possible to stop working of the EA, but to stop processing of one tick you have to invent it and work it out - I suspect that at compiler level abort() can be implemented not more complicated than ExpertRemove() - that already exists

Well, both abort and assert are implemented in the same way as in the code above. Although it's certainly ugly and sometimes confusing, because I don't always notice the preceding message in the log. Maybe there is some other error, that would return something like "internal error" in the log? At least it wouldn't look so embarrassing )

 
Alexey Navoykov:

You're right, when you start saying that, those literate people will come out of all holes, saying "this is not C++").

Well, both abort and assert are implemented in the same way as in the code above. Although it's certainly ugly and sometimes confusing, because I don't always notice the preceding message in the log. Maybe there is some other error, that would return something like "internal error" in the log? At least it would not look so embarrassing )

here@Vict helped me to make an exception with exit to OS via macro substitutionhttps://www.mql5.com/ru/forum/318246/page10#comment_12651045

, in general a workable solution, but... but it looks ugly and disgusting ! )))