Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1000

 
Where can I find an option in the terminal to start creating, auxiliary indicators that are not linked to the open chart?
 
BillionerClub:
Where can I find an option in the terminal to start creating, auxiliary indicators that are not linked to the open chart?

All you need to do when creating a HANDLE indicator is to specify the desired timeframe and symbol. For exampleiRSI indicator:

int  iRSI( 
   string              symbol,            // имя символа 
   ENUM_TIMEFRAMES     period,            // период 
   int                 ma_period,         // период усреднения 
   ENUM_APPLIED_PRICE  applied_price      // тип цены или handle 
   );
 
Vladimir Karputov:

All you need to do when creating a HANDLE indicator is to specify the desired timeframe and symbol. For exampleiRSI indicator:

No, I mean it. I think Renat said in some post about creating auxiliary, not tied to chart EAs or something like that.

 
BillionerClub:

No, that's what I mean. I think Renat said in some post about creating auxiliary, non-charted EAs or something like that.

It's called Services. We don't have them yet.

 

I have a working function under MT4 which checks server availability before placing order (parameter bool refreshrates - refresh quotes and int count - number of checks with pause if server is not available, result returns false - can trade, true server is not available. i.e. it is convenient to use if(ServerDisable() return;):

bool ServerDisable(bool refreshrates=false,int count=10)
  {
   for(int i=0;i<count;i++)
     {
      if(IsConnected())
        {
         if(IsTradeAllowed())
           {
            if(!IsTradeContextBusy())
              {
                 {
                  if(refreshrates)RefreshRates();
                  return(false);
                 }
              }
           }
        }
      Sleep(157);
     }
   Print(__FUNCTION__," Торговый сервер не отвечает");
   return(true);
  }

Help me to rewrite correctly this construction for MT5, it's calledTerminalInfoInteger() request parameters in MT5 help (i.e. I'm looking for analogy in MT5 to standard MT4 functions IsConnected(), IsTradeAllowed()... ) and how to execute RefreshRates() ?

 
Igor Makanu:

I have a working function under MT4 which checks server availability before placing order (parameter bool refreshrates - refresh quotes and int count - number of checks with pause if server is not available, result returns false - can trade, true server is not available. i.e. it is convenient to use if(ServerDisable() return;):

Help me to rewrite correctly this construction for MT5, it's called TerminalInfoInteger() request parameters in MT5 help (i.e. I'm looking for analogy in MT5 to standard MT4 functions IsConnected(), IsTradeAllowed()... ) and how to execute RefreshRates() ?

I only use this one and it seems to be enough.

TerminalInfoInteger(TERMINAL_CONNECTED)

 
Vitaly Muzichenko:

I only use this one, it seems to suffice

TerminalInfoInteger(TERMINAL_CONNECTED)

I don't want to discuss tricky brokers, the construction I showed above provides placing of an order, as well as exit from OnTick() when a tick comes, if on that tick there is no possibility to work with orders

I need exact analogues for MT5 fts: IsConnected()(TerminalInfoInteger(TERMINAL_CONNECTED) - confirmed ), IsTradeAllowed() , IsTradeContextBusy() , RefreshRates()

 
Igor Makanu:

I don't want to discuss tricky brokers, the construction I showed above provides placing orders, as well as on tick to exit OnTick() if on this tick there is no possibility to work with orders

I need exact analogues for the MT5 functions: IsConnected()(TerminalInfoInteger(TERMINAL_CONNECTED) - confirmed), IsTradeAllowed() , IsTradeContextBusy() , RefreshRates()

IsTradeContextBusy() can be excluded, the fifth thread is always free

RefreshRates() is updating of predefined Ask/Bid variables.

#define Bid (::SymbolInfoDouble(_Symbol, ::SYMBOL_BID))
#define Ask (::SymbolInfoDouble(_Symbol, ::SYMBOL_ASK))

then prices will always be up-to-date

 
Igor Makanu:

I don't want to discuss tricky brokers, the construction I showed above provides placing orders, as well as on tick to exit OnTick() if on this tick there is no possibility to work with orders

I need exact analogues for MT5 fts: IsConnected()(TerminalInfoInteger(TERMINAL_CONNECTED) - confirmed), IsTradeAllowed() , IsTradeContextBusy() , RefreshRates()

I take it you mean that the ticks are running but trading is disabled?

If so, I would like to have such a check too but no one has offered anything so far.

 
Vitaly Muzichenko:

IsTradeContextBusy() can be excluded, the fifth thread is always free

https://www.mql5.com/ru/articles/4332

IsConnected() TerminalInfoInteger(TERMINAL_CONNECTED)

IsTradeAllowed() MQLInfoInteger(MQL_TRADE_ALLOWED)

RefreshRates() SymbolInfoDouble(_Symbol, ::SYMBOL_BID)

IsTradeContextBusy() need analog or justify why the same is not possible


I need an analog and nothing more , I rewrote the above function yesterday based on the help but there is uncertainty about the correct interpretation (different words described ), now I want to confirm the correctness on the forum:

//_______________________________________________________________________
bool ServerDisable(bool refreshrates=false,int count=10)
  {
   if(MQLInfoInteger(MQL_TESTER)|| MQLInfoInteger(MQL_OPTIMIZATION))return(false);
   for(int i=0;i<count;i++)
     {
      if(TerminalInfoInteger(TERMINAL_CONNECTED))if(TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
        {
#ifdef __MQL5__
         if(refreshrates) SymbolInfoDouble(_Symbol,SYMBOL_BID);
         return(false);
#else
#ifdef __MQL4__
         if(!IsTradeContextBusy())
           {
            if(refreshrates) RefreshRates();
            return(false);
           }
#endif   // __MQL4__
#endif
        }
      Sleep(157);
     }
   Print(__FUNCTION__," Торговый сервер не отвечает");
   return(true);
  }
//___________________________________________________________________________
LifeHack для трейдера: замешиваем ForEach на дефайнах (#define)
LifeHack для трейдера: замешиваем ForEach на дефайнах (#define)
  • www.mql5.com
— В чем сила, брат?                                   —А сила, брат, в дефайнах                     Вы все ещё пишете на MQL4 и хотите перейти на MQL5, но не знаете с чего начать? Тогда мы идём к вам! Теперь появилась возможность комфортно работать в редакторе MetaEditor MQL5 и при этом использовать MQL4-нотацию (справедливости ради замечу...
Reason: