거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

Log4mql(mini) MT5 - MetaTrader 5용 라이브러리

조회수:
3258
평가:
(13)
게시됨:
2021.01.20 22:05
업데이트됨:
2021.03.09 03:35
\MQL5\Include\
log4mqlm.mqh (40.63 KB) 조회
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Log4mql(mini) - light header-only version of Log4mql that provides standardized logging.


Sample output MT5


Installation/Usage

  • Add log4mqlm.mqh to your Include folder.
  • View the sample code to get an overview of the usage.


    Inputs

    Log4mql(mini) requires only one input field. There is no logging to files.

    • Loglevel, supports Trace, Debug, Info, Warn, Error and Fatal

    Log4mql(mini) Inputs


      Message Pattern

      The message pattern will have a fixed format which corresponds to its appropriate severity level, according to below table.

       Severity Format
       Sample output
       Info (the commonly used default) %func: %msg
      OnInit:  Log level: TRACE
       Debug, Trace
      %func(%file:%line): %msg
      OnInit(log4mqlm_sample.mq5:72): initializing
       Warn
      WARN %func(%file:%line): %msg
      WARN SomeFunction(log4mqlm_sample.mq5:64): stoploss too tight
       Error
      ERROR %func(%file:%line): %msg
      optionally followed by: [, error %lasterr - %lasterrdesc]
      ERROR OnDeinit(log4mqlm_sample.mq5:85): open 'some file' failed,  error 5004 - Cannot open file
       Fatal FATAL ... as above
      FATAL  ...


      Functions

      Log4mql(mini) provides functions and preprocessor macros for logging, all macros are to be used like functions.

      Return type
      Function name
      Description
       bool
       PRINT (...)
       Prints its message if log level is set at least to INFO (= normal logging behavior).
       Supports up to 9 arguments - PRINT("1",2,etc) - if you need more, expand the templates.
       Returns true if message was logged, else false.
       bool
       PRINTF (string format,...)
       Like PRINT but prints a formatted message. Same rules as known from PrintFormat apply.
       bool
       WARN (...)
       WARNF (string format,...)
       Prints its message if log level is set at least to WARN.
       bool
       ERROR (...)
       ERRORF (string format,...)
       Prints its message if log level is at least ERROR. Adds _LastError description if set.
       bool
       FATAL (...)
       FATALF (string format,...)
       Like ERROR, but with termination. You should call ExpertRemove() or exit immediately otherwise after this.
       Example:
         if(step<MinStep) { FATALF("invalid step size: %f",step); ExpertRemove(); return; }
       bool
       DEBUG (...)
       DEBUGF (string format,...)
       Messages for DEBUG level.
       bool
       TRACE (...)
       TRACEF (string format,...)
       Messages for TRACE (more verbose than DEBUG, for function entries, calculations etc).



       string  L4mq.LastMessage()  Get the last message that has been logged.
       int  L4mq.LastLevel()  Get the severity level of the last logging event.
       int  L4mq.Level()  Get the severity level of the logger.
       string  L4mq.LevelAsString()  Get the severity level of the logger as string.
       void  L4mq.SetLevel(int)  Set the severity level for the logger.
       ulong  L4mq.SeqNr()  Get the sequence number of the last logged event.
       bool  L4mq.logged  true if the last event was logged.
           
       string  Log4mql::GetErrorDescription(int err)  Get the description of an error code like _LastError.
       string
       Log4mql::GetUninitReason(int reason)  Get the description of the uninit reason.
       string  Log4mql::LoglevelToString(int level)  Convert a log level to a descriptive string.


      Notes

      • As the functionality strives to be as simple as possible, there is no logging to files. You could implement some on your own if you want.
      • You are free to use this code in your work, however, if you share the source code you must not remove the copyright and license notice.
      • The full functionality of Log4mql is available here: https://www.mql5.com/en/code/31425 (MT4) or here: https://www.mql5.com/en/code/31452 (MT5)



      Spread Informer Spread Informer

      This EA collects information about the spread and shows the statistics on the chart. When the EA ends its working, it prints all statistics to the Journal, which can be useful for the Strategy Tester.

      selection sort - array sorting algorithm selection sort - array sorting algorithm

      an in-place comparison sorting algorithm

      Breakout Strength Meter - MT5 Breakout Strength Meter - MT5

      The breakout strength meter is a trading tool that is used to identify which currencies are the strongest to breakout, and which currencies are the weakest to breakout

      insertion sort - array sorting algorithm insertion sort - array sorting algorithm

      a simple sorting algorithm that people use to manually sort cards in a bridge hand