Questions from Beginners MQL5 MT5 MetaTrader 5 - page 830

 
Artyom Trishkin:

In this case, it's not 'better', it's exactly what you need - it's a wrapper class for standard trading functions. It does not store multiple wizards. So it needs to set a magik each time before and when it needs to open a position with a new magik.

Generally the sequence is as follows:

  • positions should be opened with magic 1 - we set magic 1 and subsequent positions will have magic 1,
  • it is necessary to open positions with a Magician 2 - we set up Magician 2 and all following positions will have a Magician 2,
  • it is necessary to open positions with magic 3 - we will set up magic 3 and every next position will have magic 3,

etc...

The reason I put it that way is because some people may have a different opinion and it works too.

 
Artyom Trishkin:

In this case, it's not 'better', it's exactly what you need - it's a wrapper class for standard trading functions. It does not store multiple wizards. Therefore, it needs to set a magik each time before and when it needs to open a position with a new magik.

Generally the sequence is as follows:

  • positions should be opened with magic 1 - we set magic 1 and subsequent positions will have magic 1,
  • it is necessary to open positions with a Magician 2 - we set up Magician 2 and all following positions will have a Magician 2,
  • it is necessary to open positions with magic 3 - we will set up magic 3 and every next position will have magic 3,

etc...

It was like this:

if(BuyCount()>0)
        {
         Print("Уже есть позиция на покупку !!!");
         return; // не добавлять к открытой позиции на покупку
        }
         SL=NormalizeDouble(latest_price.ask - STP*_Point,_Digits);
         TP=NormalizeDouble(latest_price.ask + TKP*_Point,_Digits);
         m_trade.SetExpertMagicNumber(Magic);
         m_trade.Buy(lots1,_Symbol,0,SL,TP,"Lag-MA_IAMA(conversely)_2.5.6.7 + 2");
         m_position.Select(_Symbol);
           {
            ulong myMagic=m_position.Magic();
            Print(" Открыта поза Бай с магиком № ",myMagic,", И спредом ",SymbolInfoInteger(_Symbol,SYMBOL_SPREAD));
           }

m_trade.SetExpertMagicNumber(Magic); before opening a position or afterm_trade.Buy(lots1,_Symbol,0,SL,TP,"Lag-MA_IAMA(conversely)_2.5.6.7 + 2");

 
Vladimir Karputov:

As there is noGetExpertMagicNumber method in the CTrade class, print out this code after the trade operation:

This way, you can check if both EAs have different magics.

Thank you, it is more convenient. I don't need CPositionInfo class, I don't need to select position. It works in the tester, but you have to wait for developments on the account.

 

Please tell me the difference between SymbolInfoSessionQuote andSymbolInfoSessionTrade ?
Or, same thing, what is the difference between a quote session and a trade session?

Holy crap
! And what is session_index,// session number
Do we have numbered sessions? What principle is used to number them, where is it written?

 

Please advise how to use void Ignore(long value) { m_ignore=value; } method of standard CExpertSignal class in custom Trailing class when programming in MQL5? How can I access it?

I have a custom signals class that gives me methods to open and close positions. But in Trailing I wanted to maintain position by another method. If to write separately custom classes MySignal and MyTrailing, a position is closed by the condition, which triggered first. If Trailing condition was triggered earlier, everything is fine. But sometimes a new (reversal) signal comes from MySignal and the position is reversed, and I need it to be accompanied by Trailing after opening, not closing and not opening a new one. I've looked at the base classes and there is a feeling that m_ignore from the base signals class is responsible for this. If it's assigned value 1 in the appropriate filter, it seems to work as it should. I have added filter0.Ignore(0) to the Expert Advisor class in OnInit. But I'm new to OOP and don't understand how to change this value in MyTrailing class, which is not inherited from CExpertSignal class, but is its "cousin" (let's say filter0.Ignore(1) ). Please advise how to do this.

Actually, more general question: how to pass information between two classes which are not descendants? How to transfer information from trailing class to signal class? Probably, you can create a global variable and communicate through it. But this looks quite perverted relative to the logic of protected members in OOP.


 
User_mt5:

Please tell me the difference between SymbolInfoSessionQuote andSymbolInfoSessionTrade ?
Or, same thing, what is the difference between a quote session and a trade session?

Holy crap
! And what is session_index,// session number
Do we have numbered sessions? By what principle are they numbered, where is it written?

In simple terms.

Quoting session - quoting is going on (but there may be a ban on trading).

Trading session (within or coinciding with a quotation session) - you can trade.

Session index - the index number of the session from 00:00:00-23:59:59 server time (if there are any breaks, then the session is greater than 1).

See the specification for each symbol in the market overview.

 
Kirill Belousov:

In simple terms

Quotation session - quotations are going on (but there may be a ban on trading).

Trading session (inside or coinciding with the quote session) - you can trade.

Session index - the index number of the session from 00:00:00-23:59:59 server time (if there are gaps, the session is greater than 1).

See specification for each symbol in market overview.

Thanks for the clarification. You have helped me out.

 
Vladimir Karputov:

Cent signals can now only be free.

Why can't I edit the name in my profile?

 
tsd Tsepkov:

Why can't you edit the name in the profile?

Just checked: the signal name is perfectly editable.

 
Vladimir Karputov:

I just checked: the signal name is perfectly editable.

I mean the first name, it says that you have to change it to a real name, but it doesn't work

Reason: