Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1077

 
Fast235:

Vladimir Karputov had such conditions in his codes, but you have to learn how to read his code yourself)

There is nothing to learn - to understand how a program is assembled by connecting it from ready-made blocks of the standard library - you don't even need to know programming at an intermediate level - a beginner's level is enough. Do not scare people - everything is easy and simple there.

 
Alexey Viktorov:

How does the open condition differ from the close condition?

For example:
Take Macd.
Buy: if(main<0 &&signal<0 &&main<signal)
And it closes if: signal>0
 
Sprut112:
For example:
Take Macd.
Buy: if(main<0 &&signal<0 &&main<signal)
And it closes if: signal>0

And what prevents you from making this condition?

 
Artyom Trishkin:

There's nothing to learn - understanding how a program is built by linking it together from ready-made blocks of a standard library - you don't even need to know programming at an intermediate level - a beginner's level is enough. Do not scare people - everything is easy and simple there.

in my work, too, a lot of things are obvious

 
Artyom Trishkin:

And what prevents you from making this condition?

I wanted to look in Codebase for an example, it's perfect, but I haven't found it yet
 
Sprut112:
Wanted to look in Codebase for an example, everything is perfect there, but haven't found it yet

Go to Georges, this time it's OK

 
Fast235:

Go to Georges, this time it's OK

If you can't say something sensible, don't write.
 
Sprut112:
If you can't say something sensible, don't write

I can also help, where and how will you use the code?

//+------------------------------------------------------------------+
//| Close positions                                                  |
//+------------------------------------------------------------------+
void ClosePositions(const ENUM_POSITION_TYPE pos_type)
  {
   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current positions
      if(m_position.SelectByIndex(i))     // selects the position by index for further access to its properties
         if(m_position.Symbol()==Symbol() && m_position.Magic()==m_magic)
            if(m_position.PositionType()==pos_type) // gets the position type
               m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
 
Fast235:

I can also help, where and how will you use the code?

This block is in all EAs
 
Sprut112:
This block is in all EAs

this Vladimir K. unit, what more do you need?

it's the easiest one using ctrade, if I give you my code, it will pull the library I use
Reason: