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

 
Artyom Trishkin:
It'll get it.
If
Then
But you will have to write one action per condition.
If there must be many actions in one condition, write the same condition as many times as necessary for each action.
But without brackets...

ok. To clarify.

The question is how to "patch" to write one expression and multiple operators, with indentation, without parentheses, like in pyton.

 
Andrey Sokolov:

Okay. To clarify.

The question is how to "patch" to write one expression and several operators, indented, without parentheses, like in pyton.

You can't.
You can also write your own editor that will understand and compile correctly.
Or write it in python.
 
Artyom Trishkin:
You can't.

How can you be sure that no one has implemented this by, for example, writing a patch? Pardon the criticality of the approach.

 
Artyom Trishkin:
He'll understand.
If
Then
But you will have to write one action per condition.
If there must be many actions in one condition, write the same condition as many times as necessary for each action.
But without brackets...

anything is possible. You can even do it without ;

#define  DO {
#define  END };
#define  DONE }
#define  IT(x) x;
#define  IF if (
#define  THEN ) {
#define  ENDIF };

IT(datetime time0)
IT(int ticket)

int OnInit()
DO
   IT(time0=iTime(_Symbol,_Period,0))
   IT(ticket=-1)
   IT(return(INIT_SUCCEEDED))
END

void OnDeinit(const int reason) DO IT(return) DONE

void OnTick()
DO
   IF time0!= iTime(_Symbol,_Period,0) THEN
      IT(time0 = iTime(_Symbol,_Period,0))
      IF ticket != -1 THEN 
         IT(CloseMyOrder())
      ENDIF   
      IT(ticket = OpenRandomOrder())
   ENDIF
END

Back in 90-s I knew a guy, who tried to "write in C as in Modul" with macros and preprocessor. For the same reason - he liked Modula and his projects were C...

 
Maxim Kuznetsov:

anything is possible, even without ;

back in the 90's, I knew a guy who tried to "write in C as in Modula" with macros and an additional preprocessor. For the same reason - he liked Modula and his projects were C...

good example, but looks like chinese in Old Slavonic

ZS: yes! BASIC - it looks like BASIC!!!


and here's a question... the goals are achieved and what about the use of ready-made code, do not write everything from scratch? for if you write from scratch, then why MQL ? - You need to write in a third-party language, and the only thing left is to make a connector for trading via MT

 
Maxim Kuznetsov:

anything is possible, even without ;

back in the 90's I knew a guy who tried to "write in C as in Modula" with macros and an additional preprocessor. For the same reason - he liked Modular and his projects were C...

thanks

The question is more about how to remove brackets, not replace them. So that they are "indented" as in pyton.

 
Andrey Sokolov:

How can you be sure that no one has implemented this by, for example, writing a patch? Sorry for the critical approach.

Write.

 
Andrey Sokolov:

thanks

The question is more about how to remove the brackets, not replace them. So that they are "indented" as in pyton.

You'd probably be better off writing in python. Why do you need MQL as a C-like language? It has its own syntax, in python you are used to it.

 
Maxim Kuznetsov:

anything is possible. You can even do it without ;

So it's replacing one character with another word, which is even worse. And he needs to replace it with spaces.

 
Artyom Trishkin:

So it's replacing one character with another word, which is even worse. And he needs to replace it with spaces.

There are macro-processors. The m4 comes to mind.

If you really want to scratch your left hand with your right heel across your back, you can. Add macros, pass samples through the preprocessor and feed the result to the compiler.

I don't understand the urge to do it, like everyone else. But if a person really wants to, you may. The editor will not understand him, and we will appreciate persistence and flight of fancy.