Hi, Im trying to find a way to import a library (or .dll file) with the filename being defined externally.
For example, this is what I am trying to accomplish:
User creates a file "MY_FILE.mq4" ("MY_FILE.ex4" after compiling), saving it in the libraries folder.
User runs my EA, "supertradesEA.ex4".
In the 'Expert properties' window there is an input string where the user would manually type "MY_FILE.ex4" ... or whatever they name their file
This imports the code from the file the user created.
This is the problem that Im having:
#import requires the filename to be written and put into double quotes as in...
Despite the (" ") format, filename.ex4 apparently is not of string type per se.. therefore, I cannot use the following construct:
extern string inputFile = "TYPE YOUR FILENAME HERE"; // <--- user types this manually in 'Expert properties' window
#import inputFile //--- their code is imported
If I try doing this I get the following error: " 'import' - double quotes needed " ..but of course putting double quotes around it defeats the whole concept.
..any way around this??
Pipfinite creates unique, high quality and affordable trading tools.
Our tools may or may not work for you, so we strongly suggest to try the Demo Version for MT4 first. Please test the indicator prior to purchasing to determine if it works for you.
We want your good reviews, so hurry up and test it for free...we hope you will find it useful.
Breakout Analyzer with Volume Critical
Strategy: Enter confirmed reversal setups Watch Video: (Click Here)Breakout Analyzer with Strength
COSMOS4U Volume indicator facilitates your trade decisions. It gives confirmation of the running movement and market trends. It highlights current and past accumulation and distribution volumes, comparing them to moving average volume and the highest volume. In addition, it identifies and marks nuances as well as convergence and divergence patterns of bears and bulls in order to provide the market trend and price ranges.
The supported features are as follows:
Fast Volume Moving Average Slow
The Heiken Ashi indicator drawn using a tick chart. It draws synthetic candlesticks that contain a definite number of ticks.
option prices - price option. It can be Bid, Ask or (Ask+Bid)/2. the number of ticks to identify Bar - number of ticks that form candlesticks. price levels count - number of displayed price levels (no levels are displayed if set to 0 or a lower value). calculated bar - number of bars on the chart.Buffer indexes: 0 - OPEN, 1 - HIGH, 2 - LOW, 3 - CLOSE.
Does not support hedging orders on a single symbol on MT5
MultiMTCopier MT5Receiver - new and improved multi-terminal positions copier for your real/demo account, works faster, requires less, flexible in managing and upgrading, new information support. This Expert Advisor is designed for the MetaTrader 5 terminal, trades will be copied into this terminal.
The EA will copy all positions without delays Additionally integrated notification in situations requiring user attention
The indicator displays economic news on the currency chart (the appropriate data must be downloaded from the Internet - please see the download instructions on the screenshots provided). The list of currencies (countries) is customizable. By default it shows all currencies. The main parameters come with a built-in description. In addition, there are parameters for advanced users. News items are divided into 3 categories by degree of importance. There is a great flexibility in display parameter s
The most profitable trend traders are the ones who know how to recognize not only the market trend, but also the trading opportunities that arise once a trend has been established. The Pz Trend Trading indicator has been designed to profit has much as possible from trends taking place in the maket.
Established trends offer dozens of trading opportunities, but most trend trading indicators neglect them completely, and leave the trader completely uninformed about what the market is doing during a
Safe Automatic is a safe MetaТrader 5 trading robot working autonomously on a VPS server. The good results are achieved on EURUSD.
The EA applies modified versions of a trend-following strategy, half-pyramiding, scalping, Elliott Wave method and speculating trading with a deposit protection. The EA switches the strategies automatically. The program also takes the news calendar into account: the robot does not enter the market in a 10-minute interval before and after a news rel
MetaCOT 2 is a set of indicators and specialized utilities for the analysis of the U.S. Commodity Futures Trading Commission reports. Thanks to the reports issued by the Commission, it is possible to analyze the size and direction of the positions of the major market participants, which brings the long-term price prediction accuracy to a new higher-quality level, inaccessible to most traders.
These indicators, related to the fundamental analysis, can also be used as an effective long-term filte
The script creates account summary report in a separate window.
The report can be created for all deals and on deals for selected financial instruments.
It is possible to specify a time interval of calculation and save report to htm-file.
The script creates account summary report in a separate window.
The report can be created for all deals and for deals of the selected financial instruments.
It is possible to specify a time interval of calculation and save report to htm-file.
Averager is intended for averaging your deals that has had a drawdown or had gone against the trend.
An example of operation of the averager in an Exeprt Advisor in the MetaTrader 5 terminal: Exp - TickSniper. The system is identical to the averaging system created for MetaTrader 4. A demo version of the averager for MetaTrader 5: Averager DEMO.Note: this is not an automated trading system (the EA doesn't work in the strategy tester). It monitors your deals and averages them in case o
The fractal analysis of the markets is used in the indicator operation algorithm. According to the fractals theory, after the breakthrough of the fractal level confirmed by the closing price located below or above the fractal, the trend wave in the direction of the breakthrough starts to develop. Until the fractal has been passed in the opposite direction, the trend is considered to be acting even if the price is flat or moves backwards. If a bullish fractal has been previously broken through on
The script is intended for automatic placing of Buy Stop pending orders, Stop Losses and Take Profits on the user specified levels.
Avoiding unwanted entering a long position in case of false hitting the level as a result of widening of the spread by a dealing center. Avoiding unwanted triggering of a Stop Loss in case a quote pierces a significant level (fractal) without further confirmation with the close price. Setting a necessary virtual order and entering the market in
The script allows users to easily close positions if their profit/loss reaches or exceeds a value specified in pips.
Please set slippage value first. Sometimes some positions do not close due to high volatility of the market. Please set larger slippage or restart the script.
MACD All MAs-14 is a MACD indicator that allows choosing usual parameters of the standard MACD (constructed from EMA) as well as the type of the moving average to be applied: up to 14 different types.
You can select 9 standard MAs available in MetaTrader 5 - SMA, EMA, SMMA, LWMA, DEMA, TEMA, Frama, VIDYA, AMA, TRIX, and 4 non-standard - LRMA, HMA, JMA, AFIRMA.
Method MA - select the type of moving average to be displayed in the current graph. Period slow MA - the number
A script for opening a grid of orders
If you need to quickly open several pending orders (Buy Limit, Sell Limit, Buy Stop, Sell Stop) on a certain distance from the current price, this script will do all the routine for you! Allow AutoTrading before running the script.
Run the script on a chart.
Language of messages displayed (EN, RU, DE, FR, ES) - language of the output messages (English, Russian, German, French, Spanish). Price for open - open price. If set to
The indicator determines the inside bar and marks its High/Low. It is plotted based on the closed candles (does not redraw). The identified inside bar can be displayed on the smaller periods. You may set a higher period (to search for the inside bar) and analyze on a smaller one. Also you can see the levels for Mother bar.
Period to find Inside Bar — the period to search for the inside bar. If a specific period is set, the search will be performed in that period. Al
Auto Trade Copier is designed to copy trades between multi MetaTrader 5 accounts/terminals with 100% accuracy.
With this tool, you can act as either a provider (source) or a receiver (destination). All trading actions will be copied from the provider to the receiver with no delay.
Note: Demo version for testing can be downloaded at: https://www.mql5.com/en/market/product/5006.
Followings are highlight features:
Switch between Provider or Receiver role within one tool.One provider can copy tr
The Trade Manager Pro EA is a MetaTrader Expert Advisor that performs position management for you avoiding human errors and enhancing your trading activity.
Amazingly easy to use Trade easily from the chart Trade with precise risk management, hassle free Capital preservation is top priority Let profits run without your attention Enjoy risk-free trades as soon as possible Automatic trailing stops for all opened trades Initial stop losses are placed as soon as trades are
The script is intended for automatic placing of Sell Stop pending orders, Stop Losses and Take Profits on the user specified levels. This script is not that useful as "Virtual pending buy stop", since short positions are opened as Bid price crosses the levels. Thus spread widening is not dangerous. Nevertheless, you need to have this script to prevent unwanted hitting of the Stop Loss levels.
Automation of the process of placing the Sell Stop pending orders, Stop Losses and T
The indicator represents an additional chart window with a lower time frame where bars are combined into groups that are equivalent in time to main chart time frame. Bars are synchronized by the right hand side of the window, i.e. the time of the last bar in the main window corresponds to the time of the last bar group in the additional window. The maximum number of groups is 16; the maximum number of bars combined into groups in the additional window is 256. Limitations on the numbers are requi
CandleTimer is an indicator that can be usable for scalper and short-term traders. It shows the following useful information:
Remaining and past time of a candle on the current chart or other timeframe Alarm setting for play sound at the start of the current candle Show SL/TP line defining whether the indicator has a Sell or Buy order or both Show a spread value Show Ask and Bid lines in different colors in high and low spread Compatible with a money management EA (you can buy it separat
Exp COPYLOT CLIENT for MT5 is a copier for the МetaТrader 5 platform. It copies forex trades from any accounts. Including those from terminals МТ5 and МТ4.
Install the Expert Advisor in the terminal where you want to copy trades. Specify any text label name as pathRead, for example, "COPY". This should match the master terminal (to bind the two terminals). To copy trades, you need to install the free Master copier in the terminal from where you want to copy the trades: COPYLOT
Auto Trade Driver is an automatic powerful tool (run as Expert Advisor) that helps you to manage risk and control orders and maximize your profit in multi-protect/trailing-stop rules.
This tool is very useful for both scalpers and trend followers. It not only calculates the trade risk exactly, but also protects and maximizes your profits in real-time.
With this tool, the only thing you have to do is to enter trade by your own strategy, then it will auto-drive your position with exit strategy y
We present you an effective software solution for arbitrage between brokers.
The Arbitrage on the market became widespread due to decentralization. There are many liquidity providers, whose quotes differ for various reasons. By tracking the dynamics of changes in the quotes of different brokers, it is possible to determine the delayed and leading brokers, thereby predicting the future prices of the delayed broker for a short time. Knowing these prices and using efficient built-in software filte
The Expert Advisor implements the classic "triangular arbitrage", which is successfully used by hedge funds.
"Triangular" arbitrage refers to a class of neutral-market strategies, in which the profit or loss of open positions does not depend on the direction of the market movement as a whole.
In order to take profit, the EA exploits a weak spot of market makers - it utilizes the difficulty of balancing cross rates of all currency pairs.
The advantages of the strategy are the following:
Market Profile defines a number of day types that can help the trader to determine market behaviour. A key feature is the Value Area, representing the range of price action where 70% of trading took place. Understanding the Value Area can give traders valuable insight into market direction and establish the higher odds trade. It is an excellent addition to any system you may be using.
Blahtech Limited presents their Market Profile indicator for the MetaTrader community. Inspired by Jim Dalton’s
Ichimoku Kinko Hyo is a purpose-built trend trading charting system that has been successfully used in nearly every tradable market. It is unique in many ways, but its primary strength is its use of multiple data points to give the trader a deeper, more comprehensive view into price action. This deeper view, and the fact that Ichimoku is a very visual system, enables the trader to quickly discern and filter "at a glance" the low-probability trading setups from those of higher proba
Does not support hedging orders on a single symbol on MT5
MultiMTCopier MT5Source - new and improved multi-terminal positions copier for your real / demo account, works faster, requires less, flexible in managing and upgrading, new information support. This expert is designed for terminal MetaTrader5 from which the position will be copied.
The EA will copy all positions without delays Additionally integrated notification in situations requiring user attention Buttons for re
Virtual TrailingStop is an Expert Advisor that manages trailing stop without sending its information to the broker server.
EnableVirtualTrailingStop: enable or disable whole function VirtualTrailingStop: the pip use for determine how far the Virtual Trailing Stop will placed calculated from current price StartFromBreakEven: true/false. If true, Virtual Trailing Stop will placed after breakeven BreakEvenPoint: point profit from order open price where the Virtual T
Trade Copier Pro is a powerful tool to copy trade remotely between multiple accounts at different locations over internet. This is an ideal solution for signal provider, who want to share his trade with the others globally on his own rules. One provider can copy trades to multiple receivers and one receiver can get trade from multiple providers as well. The provider can even set the subscription expiry for each receiver, so that receiver will not be able to receive the signal after that
not possible in plain mql4. The language is just too limited. Although you could call LoadLibrary() from the windows API and also get the function address of an exported function you would still be unable to actually call this function because MQL4 does not have function pointers. MT4 programs are static like blocks of concrete (even C would appear like a dynamic language if compared to mql4), there is no possibility of any sort of late binding, not even through the most creative hacks.
You should implement this mechanism in a DLL that is written in a language that allows dynamically loading and calling libraries at runtime such as Object Pascal (if you prefer structure, orderliness and beauty) or C++ (if you prefer chaos, anarchy and anomaly).
I am fairly new to programming and am not yet familiar with some of the more sophisticated concepts. Are you saying that the DLL file should be written in a more dynamic language? How would that change the fact that the DLL file is being implemented by MQL4..a static language, as you put it.
Perhaps there is another solution to my problem. Late binding would be an overly complex solution in my case..all I need is to import a few instruction from the user to the EA. This only needs to be done once, on initialization.
Is there a way that plain text, located in a .txt file, can be opened, read, and made to appear to the compiler as code within an if() statement?
I write a text file that reads: "haveinput == true" in plain text, as it is here. I name the file "mytextfile.txt"
Then in my .mq4 file I have something like:
if( ~~open mytextfile.txt, read it's contents and place the character strings here as code..somehow~~ )
..to the compiler it would appear as:
if(haveinput == true)
is that even feasible??
You are trying to make some sort of self-modifying code or dynamically loading or exchanging code at runtime that was not yet known at compile time. This is not possible in mql4. It is possible (more or less complicated) in ALMOST ANY other language but NOT in mql4 because mql4 is severely limited.
Maybe I should ask the question what are you trying to achieve, not what you are trying to do (you explained this already and it will not work) but instead what is the reason WHY you are trying to do this? Maybe there is a better (and entirely different) approach. For example if you just want to load configuration data for some predefined variables then it would be possible without trying to load code at runtime. You would instead only read data (not code) and assign it to some variables.
Ok, here goes :)
Im looking to develop a EA such that the user defines their own trading criteria, filtering criteria, etc. The EA is built in a generic way such that it can be easily adapted to employ almost any trading strategy conceivable. The user would only need to type in some simple code to define their trading criteria, then set some external input variables that allow for the use of many popular trading techniques and methods (various entry stop, stoploss, TP algorithms, as well as other tweaks etc).
The issue Im having is in regards to how a user can define their own criteria (which, at this point, requires MQL coding) all the while not having access to the source code. At present, I simply have the source code import an EX4 file (created from a .MQ4 library) that stores a simple function which defines all trading criteria. The function is called within the source code where necessary, and return TRUE or FALSE depending on whether various types of criteria have been met. This imported EX4 file would be provided to the user as a template in MQ4 format, they would only need to alter a few lines of code to redefine the EA's trading strategy entirely.
The problem is that the filename of this imported file must remain static in order for the source code to recognize it. I envision a user whipping up several version of this small template file, each defining a specific trading strategy (i.e. MACrossover.mq4, ScaplingStrategy.mq4,..., ..and so on) and using the source code-driven EA as a black-box to execute/test the specific strategy. But once you change the filename, my source code will no longer recognize the file and obviously will not import it. This means that each time the user wants to switch strategies, they need to go into the same library file, who's name must remain exactly the same, and rewrite/copy-paste new code into the template...very cumbersome!
What I would rather have them do is to create a specific version of the template file once for each strategy, give it a unique name, then simply type the filename into the 'Expert properties' input window. They can even save the input setting and switch strategies by loading those within seconds...this is much more elegant.
What do you think? Possible or beyond MQL4? Perhaps maybe MQL5??
Thanks for you help with this btw, much appreciated!
It is possible for one MQL4 indicator/EA to call not-known-at-compile-time MQL4 code via the iCustom instruction.
So a work-around might be to treat the not-known-at-compile-time code as an indicator, pass the EA its name as an input parameter, and pass up to 8 double values back as indicator values 0-7 (or more if the values are constant & treat 'bars age' as another level of value index).
Another way is to write a parser in MQL4 (or even a DLL in another language) and use that to parse the code, and pass in & out values.
This is a quite sophisticated project if you are just beginning to learn programming.
You could have a look at the mql4-python bindings, they allow the importing of python modules at runtime and calling of python functions from within mql4. Your user would then define his strategy in python. Unfortunately you cannot call back into mql4 from python, all your python functions can do is to return values or set variables that you can read after the function has been called.
All EA instances would share the same python interpreter, so you would need to encapsulate the user strategy into a class that is instantiated once per running EA (or otherwise make it thread safe). You could then import the file containing this class at runtime, create an instance of it (belonging to this EA/pair/timeframe) and call its methods. The disadvantage is: The user must have python-2.6 installed on his PC and the python wrapper dll in the libraries folder.