Giter Site home page Giter Site logo

roflamo / ea31337-classes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ea31337/ea31337-classes

0.0 1.0 0.0 698 KB

:page_facing_up: EA31337 framework (MQL library for writing EAs)

License: GNU General Public License v3.0

MQL5 93.82% MQL4 6.18%

ea31337-classes's Introduction

EA31337-classes

EA31337 framework for writing trading robots for MetaTrader 4 and 5 platforms.

Build status

Type Status
Travis CI build Build Status
AppVeyor build Build status

Class hierarchy

.
|-- Account (Orders)
|-- Terminal (Log)
|   |-- SymbolInfo
|   |   |-- Market
|   |   |   |-- Chart
|   |   |   |   |-- Draw
|   |   |   |   |-- Indicator
|   |-- Tester
|   |-- Session
|   |   |-- Check
|   |   |-- Registry
|   |   |-- RegistryBinary
|   |   |-- File
|-- Trade (Account, Chart, Log)
|-- Order (Market)
|-- Strategy (String, Trade)
|-- Indicators
|-- Strategies
|-- Rules (Condition, Action)
|-- Array
|-- DateTime
|-- BasicTrade
|-- Convert
|-- Inet
|-- MD5
|-- MQL4
|-- Mail
|-- Math
|-- Misc
|-- Msg
|-- Report
|-- SVG
|-- SetFile
|-- Stats
|-- SummaryReport
|-- Task
|-- Tests
|-- Ticker
|-- Timer (Object)

Profiler class

The purpose of Profiler class is to profile functions by measuring its time of execution. The minimum threshold can be set, so only slow execution can be reported.

Example 1

Example to measure execution of function multiple times, then printing the summary of all calls which took 5ms or more.

#include "Profiler.mqh"

void MyFunction() {
  PROFILER_START
  Sleep(rand()%10);
  PROFILER_STOP
}

int OnInit() {
  for (uint i = 0; i < 10; i++) {
    MyFunction();
  }
  // Set minimum threshold of 5ms.
  PROFILER_SET_MIN(5)
  // Print summary of slow executions above 5ms.
  PROFILER_PRINT
  return (INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
  PROFILER_DEINIT
}

Example 2

Example to measure execution of function multiple times, then automatically printing all calls which took 5ms or more.

#include "Profiler.mqh"

void MyFunction() {
  PROFILER_START
  Sleep(rand()%10);
  // Automatically prints slow executions.
  PROFILER_STOP_PRINT
}

int OnInit() {
  // Set minimum threshold of 5ms.
  PROFILER_SET_MIN(5);
  for (uint i = 0; i < 10; i++) {
    MyFunction();
  }
  return (INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
  PROFILER_DEINIT
}

Timer class

The purpose ofTimer class is to measure time between starting and stopping points.

Example 1

Single timer:

#include "Timer.mqh"

Timer *timer = new Timer("mytimer");
timer.Start();
// Some code to measure here.
timer.Stop();
Print("Time (ms): ", timer.GetSum());
timer.PrintSummary();
delete timer;

Example 2

Multiple measurements:

#include "Timer.mqh"

Timer *timer = new Timer(__FUNCTION__);
  for (uint i = 0; i < 5; i++) {
    timer.Start();
    Sleep(10); // Some code to measure here.
    PrintFormat("Current time elapsed before stop (%d/5): %d", i + 1, timer.GetTime());
    timer.Stop();
    PrintFormat("Current time elapsed after stop (%d/5): %d", i + 1, timer.GetTime(i));
  }
timer.PrintSummary();
delete timer;

Support

ea31337-classes's People

Contributors

kenorb avatar lemonboy avatar lu43n avatar nickodell avatar lucasbodek avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.