• Sign up >>

Running a program from MetaTrader is not a hard thing anymore!

To add comments, please log in or register
Ahmed Soliman
23545
Ahmed Soliman  

Hi folks,

Scenario 1:

The EURUSD went up, I want to tell the boss. What if the MetaTrader can open my email client!

Scenario 1:

The EURUSD went down. Could MetaTrader open the notepad to write a piece of note.

If you are a lazy person like me, or you have more useful ideas (scenarios) about running applications from MetaTrader!

Running a program from MetaTrader is not a hard thing anymore.

Just you this library.

And enjoy with the Shell function:

Usage:

use this function to run any program you want from your MQL code.

Parameters:

FullPath (string) the full path and the file name

Parameters (string) any parameters you want to pass to the program

Return vale:

(int) the handle of the program in success and -1 in error

Example:

int res = Shell ("c:\\window\\notepad.exe", "");

http://www.metatrader.info/node/89

Hap Alkos
19
Hap Alkos  

cglib

It is nice to have this capability.

I noticed the download file is named cglib.mq4

I change it to cglib.mqh and placed it in the include file.

Works great!

As a test of the Shell function, I opened a .csv file in ...\experts\files with a text editor.

Thanks for the good work.

hap

Ahmed Soliman
23545
Ahmed Soliman  

You're welcome!

hapalkos:
It is nice to have this capability.

I noticed the download file is named cglib.mq4

I change it to cglib.mqh and placed it in the include file.

Works great!

As a test of the Shell function, I opened a .csv file in ...\experts\files with a text editor.

Thanks for the good work.

hap

You're welcome!

hap, do you have any tools request?

Hap Alkos
19
Hap Alkos  

scheduling utility

codersguru,

This is in response to your request for tools. Look it over and see if you think that it is reasonable and useful. You may have a ready alternative.

I am currently working on a project using EXCEL. By utilizing the MT4 DDE addressing (=MT4|BID!GBPUSD, etc.) for real time price values, I have created a dynamic display (real time display of price changes, percentages, probabilities, moving bars, highlighted targets, etc.). I also utilize data extracted to a .csv file by means of an MT4 script. The .csv data is read by EXCEL with Database Query. The time frame of interest for this worksheet is daily and the values that I extract from MT4 change very little during the course of a day. So I need to run the script once or twice a day. Currently I just drag and drop the script into any chart. The script is written so that it extracts current values and ArrayCopyRates data with set Symbols and Time Periods so that there is no need for the script to read any values in the chart. This updating procedure is simple and straight forward but I would like it to occur automatically on a scheduled basis. If this were possible then I would consider constructing the display for lower time frames.

I modified the script to run as an EA with a Sleep command. This works fine as long as the Expert Advisors is active and the EA is installed on a chart in the active profile. If I change to a different profile the updating stops. I would rather drag and drop than rely on an EA for this procedure.

I also modifed the script to run as an indicator but burdening the process thread with this type of demand seems unnecesary. Also if the indicator is not in an active profile, no update.

What I would like is a utility that could set a fixed schedule (once a day, once an hour, etc.) for the running of a script automatically without being dependent on an EA or active profile.

This project started with just the desire to automate some of the process of doing some very basic spreadsheet calculations. It has now grow into a dynamic indicator. One of the challenges has been the data transfer. Primarily how to best accomplish this with Excel. Any insight you have in working with Excel would be much appreciated.

hap

sx ted
20
sx ted  

Amazing Shell()

Real cool, thank u CodersGuru, keep up the good work, take care.

Ahmed Soliman
23545
Ahmed Soliman  
sx ted:
Real cool, thank u CodersGuru, keep up the good work, take care.

sx ted,

You're welcome!

Hope it helps!

TimeFreedom
520
TimeFreedom  

Dde

CodersGuru,

Hopefully you can help me with the following task. I would like to capture live or import historical data using DDE. Do you know of the santax to import data from a certain bar. Let's say for example I want the OHLC for August 10, 2006: 14:30 bar, M1 chart?

Thanks in advance,

TimeFreedom

codersguru:
Hi folks,

Scenario 1:

The EURUSD went up, I want to tell the boss. What if the MetaTrader can open my email client!

Scenario 1:

The EURUSD went down. Could MetaTrader open the notepad to write a piece of note.

If you are a lazy person like me, or you have more useful ideas (scenarios) about running applications from MetaTrader!

Running a program from MetaTrader is not a hard thing anymore.

Just you this library.

And enjoy with the Shell function:

Usage:

use this function to run any program you want from your MQL code.

Parameters:

FullPath (string) the full path and the file name

Parameters (string) any parameters you want to pass to the program

Return vale:

(int) the handle of the program in success and -1 in error

Example:

int res = Shell ("c:\\window\\notepad.exe", "");

http://www.metatrader.info/node/89
Jos Theelen
100
Jos Theelen  
codersguru:
You're welcome! hap, do you have any tools request?

Thanks. I am not hap, but could you add some function that checks if the extern program is still running.

So I can let MT4 save some file. Then I shell a function to read that file and do some weird calculations and save the results. If i can check that my calculations are finished, I can let MT4 read the results and work with them.

An example is BrainMaker.exe, a neural network that can be called in that way from MT4.

Ahmed Soliman
23545
Ahmed Soliman  
JosTheelen:
Thanks. I am not hap, but could you add some function that checks if the extern program is still running.

So I can let MT4 save some file. Then I shell a function to read that file and do some weird calculations and save the results. If i can check that my calculations are finished, I can let MT4 read the results and work with them.

An example is BrainMaker.exe, a neural network that can be called in that way from MT4.

Do you mean you want a tool (dll - function ) that tells you if a specific program is running or not?

Jos Theelen
100
Jos Theelen  
codersguru:
Do you mean you want a tool (dll - function ) that tells you if a specific program is running or not?

Yes, that's it.

Ahmed Soliman
23545
Ahmed Soliman  
JosTheelen:
Yes, that's it.

Well, another question!

Is the program you want to monitor (running/ not running) has a window?

A window means it's a visable program and it's window is shown not a system tray or a hidden program.

Why i'm asking? Because if the program has a window it will be easier to find and if it hidden it will be PC resource consuming to make this dll!

123
To add comments, please log in or register