Coder Social home page Coder Social logo

mql4-env's Introduction

MQL4-Env

MQL4 handles environment setting files for each account.

Requirement

Install

  1. Donwload Env.mqh and defines.mqh
  2. Save the file to /MQL4/Include/mql4_modules/Env/

Usage

Prepare the environment file

  1. Make a file (.txt or .ini) in /MQL4/Files/
  2. Write the setting in the form of key = value in the created text file.
API_TOKEN=123456890-hogehogehoge
ACCOUNT=123
IS_DEBUG=true

How to use

  1. Includes Env.mqh
  2. Read the configuration file.
  3. Acquire value from environment setting file.

To get the value, execute the get method.

string api_token = Env::get<string>("API_TOKEN");

Env::get (initial value if key, key does not exist).
Initial value can be omitted.
If the initial value is omitted and a key does not exist, a value equivalent to NULL or NULL is returned.
To get the bool type value, execute the getBoolValue method.

#property strict

#include <Env.mqh>


int OnInit(){
   Env::loadEnvFile("sample.ini");
   Comment("API_TOKEN = ", Env::get<string>("API_TOKEN"), "\n",
           "USER_NAME = ", Env::get<string>("USER_NAME", "MQL4"), "\n",
           "ACCOUNT = ", Env::get<int>("ACCOUNT", 0), "\n",
           "IS_DEBUG = ", Env::getBoolValue("IS_DEBUG", false));

   return(INIT_SUCCEEDED);
}


void OnTick(){
   
}

image

mql4-env's People

Contributors

ggjiwabuchi avatar keisukeiwabuchi 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.