Coder Social home page Coder Social logo

mt4-expander's Introduction

MetaTrader 4 framework DLL extension

This project is part of the MetaTrader 4 development framework.


Build environment

For backward compatibility with Windows XP the DDL is built with Visual Studio 2008 (an Express version was not tested). It may be possible to setup a current version of Visual Studio to support Windows XP (or to skip Windows XP support at all).

Shared header files

The header files in {expander-root}/header/shared should be shared with the MetaTrader 4 MQL framework to make sure that definitions in both projects match. It can be accomplished by symlinking the files from {rosasurfer/mt4-mql}/mql4/include/shared to {expander-root}/header/shared. The DLL can be build with and without shared headers. If you get the error Cannot open include file: 'shared/defines.h': No such file or directory symlink the shared files or run the build tool at least once to setup building without shared headers.

Pre/Post-build events

If the Visual Studio build tool can't find the header files in {expander-root}/header/shared the pre-build event restores backups from {expander-root}/header/shared/bak.

After a successfull build the post-build event creates new backups of the currently used files. If a (symlinked) directory {expander-root}/bin/mql4-libraries is found the resulting DLL is copied into that directory.

:: Pre-build event
if not exist "$(ProjectDir)header\shared\defines.h" (
   echo Shared header "$(ProjectDir)header\shared\defines.h" missing, using backup...
   copy "$(ProjectDir)header\shared\bak\defines.h" "$(ProjectDir)header\shared\"
)
if not exist "$(ProjectDir)header\shared\errors.h" (
   echo Shared header "$(ProjectDir)header\shared\errors.h" missing, using backup...
   copy "$(ProjectDir)header\shared\bak\errors.h" "$(ProjectDir)header\shared\"
)
:: Post-build event
echo Backing up shared header files...
copy "$(ProjectDir)header\shared\*.h" "$(ProjectDir)header\shared\bak\"

if exist "$(ProjectDir)bin\mql4-libraries\" (
   echo Copying DLL to MetaTrader MQL libraries...
   copy "$(TargetPath)" "$(ProjectDir)bin\mql4-libraries\rsfMT4Expander.$(ConfigurationName)$(TargetExt)"
)

Managing symlinks and junctions on Windows

A comfortable way to manage Windows reparse points is the free Link Shell Extension by Hermann Schinagl. To activate Git support for symbolic links on Windows add the config option core.symlinks = true to your Git configuration:

$ git config --global core.symlinks true

mt4-expander's People

Contributors

rosasurfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mt4-expander's Issues

Can you turn ShiftIndicatorBuffer into a template

I want to use the ShiftIndicatorBuffer from the dll rsfMT4Expander.dll

https://github.com/rosasurfer/mt4-expander/blob/47dbb1a57439b233117f7b141c6b4b010f39e57a/src/util/helper.cpp

/**
 * Shifted die Werte eines IndicatorBuffers um eine Anzahl von Bars nach hinten. Die ältesten Werte verfallen.
 *
 * @param  double buffer[]   - MQL-Double-Array (IndicatorBuffer)
 * @param  int    bufferSize - Größe des Arrays
 * @param  int    bars       - Anzahl der zu shiftenden Bars
 * @param  double emptyValue - Initialisierungswert für freiwerdende Bufferelemente
 *
 * @return BOOL - Erfolgsstatus
 **/

BOOL WINAPI ShiftIndicatorBuffer(double buffer[], int bufferSize, int bars, double emptyValue) {
   if (buffer && (uint)buffer < MIN_VALID_POINTER) return(error(ERR_INVALID_PARAMETER, "invalid parameter buffer = 0x%p (not a valid pointer)", buffer));
   if (bufferSize < 0)                             return(error(ERR_INVALID_PARAMETER, "invalid parameter bufferSize = %d", bufferSize));
   if (bars < 0)                                   return(error(ERR_INVALID_PARAMETER, "invalid parameter bars = %d", bars));
   if (!bufferSize || !bars) return(TRUE);

   MoveMemory((void*)&buffer[0], &buffer[bars], (bufferSize-bars)*sizeof(buffer[0]));

   for (int i=bufferSize-bars; i < bufferSize; i++) {
      buffer[i] = emptyValue;
   }
   return(TRUE);
   #pragma EXPANDER_EXPORT
}

but I a big number of buffers and I have various types of buffers, like ''char'' , ''long'' and so on so I really need a template for this. So instead of only ''double'', ShiftIndicatorBuffer(double buffer[], int bufferSize, int bars, double emptyValue) would take any type of buffer and MQL will do whatever it has to do to make sens of it.

How to use this library?

@rosasurfer
Hi Peter,
I'm looking for some libraries for MT4 to export live data and integrate with terminal trading functions, so I've been looking a lot at the various repos of: https://github.com/dingmaotu

However, yours seem more updated, but not at all documented. So what is this one used for? (And the others?)

Implement WindowHandleEx() in DLL

Necessary precondition for initializing/updating the main execution contexts solely in the DLL. After implementation the MQL {MainModule}::UpdateExecutionContext() functions can be removed and the contexts can be initialized with a single call of Expander::SyncMainContext_init().

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.