Questions from Beginners MQL4 MT4 MetaTrader 4 - page 64

 
FOTOGRAF14:
If I could just get a little more direction, I'd be fine! Everyone says write the codes, write the codes. I couldn't agree more! There's a way out! I need some exercises to practice!!! If someone had given them to me and I had written them and showed them to them for verification, I would have been able to write five codes by myself!
So here on the forum there are topics like "I'll write something for free", here are the problems.
 
FOTOGRAF14:
If I could just get a little more direction, I'd be fine! Everyone says write the codes, write the codes. I couldn't agree more! There's a way out! I need some exercises to practice!!! If someone gave them to me, I would write them and show them to check them.
Reference books are useful for those who know another programming language and for those who have forgotten something in them (you can't keep all the functions in your head). I did! I tried to understand them, but I'm not at the right level to understand them yet
 
Vitalie Postolache:
So here on the forum there are topics like "I'll write something for free", that's the problem.
It's like an answer, boy, don't get in the way of serious business, and you're in the way! How can I write an Expert Advisor that someone else comes up with without understanding it? I understand it when I can write more or less, and you take on free orders for training.
 
FOTOGRAF14:

OK, here's the challenge. Write an advisor. Is in the market all the time. Opens sell, buy, sell, etc. The type of the first order is arbitrary. There is a SL and TP to each order. It should be placed in the entry parameters. As soon as there are no orders in the market, this EA checks the type of the last closed order and places the opposite order at the current price. When testing in the tester/demo there should be no errors. Lot - minimum for the account.

Write and I will check it. If it doesn't work by code - just even write your thoughts, how would you think, solving this problem. Where would you start, etc.

 
Please see what's wrong with it, in terms of errors, I can't seem to find where
 
FOTOGRAF14:
Please check what's wrong with the errors, I can't find anywhere.

OnInit() has no closing parenthesis.

Please post the code instead of an image - it's hard to compile a picture.)

 
FOTOGRAF14:
Please see what's wrong with the errors, I can't seem to find where.
Each function must return a value of some type. Look in the documentation what type the OnInit(), OnTick(), OnDeinit() functions return.
 
Yes, of course there should be a second parenthesis, note the highlighting. In OnTick() too.
 
FOTOGRAF14:
Hello! I don't quite understand where to write void, where to write simply return; where return(0), when I should write simply OnTicK(). I used to write int start() everything was clear. Now everything is mixed up, with this fucking update.... I'm learning by Kovalev, but it's outdated, what should I do? I can't ask anyone, they were almost born with this knowledge! How can I learn the whole thing......................

If the function starts with void, it does not return values, so exit with return.

In almost all other cases, you need to apply reurn(x), where x is the value returned by the function.

The template for the Expert Advisor has three functions in its simplest form:

#property strict

int OnInit()
   {

      return(INIT_SUCCEEDED);
   }
void OnDeinit(const int reason)
   {

   }
void OnTick()
   {

   }

 
Renat Akhtyamov:

Template for an advisor

#property strict

int OnInit()
   {

      return(INIT_SUCCEEDED);
   }
void OnDeinit(const int reason)
   {

   }
void OnTick()
   {

   }

Woah... why... The man wants to learn...
Reason: