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??
This is an unusual (visual) representation of the famous WPR indicator. Instead of a separate subwindow, it is displayed in the main chart as a channel and levels.
The next version of the indicator will have a possibility of smoothing its values using a moving average.
PeriodWPR - calculation period of the percent price channel LevelUp - the value of the upper level in percentage (negative) LevelDn - the value of the lower level in percentage (negative) Center - the value of t
The indicator is designed for easy construction of synthetic charts based on data of various financial instruments. It will be useful both arbitrage and pair trading, as well as for analysis purposes. Its main advantage is simplicity and clarity. Each chart is given as a common mathematical formula. For example, if you want to plot the spread (difference) between EURUSD and GBPUSD with coefficients 4 and 3, then set the following formula:
EURUSD * 4 - GBPUSD * 3
The resulting chart is shown in
Create your own list of trading instruments Watch list* and combine it with several open charts Link **.
Using this program, a user can create fully-fledged Watch lists, create and delete trading instruments and move through the list.
A selected symbol shows charts in linked windows. Linked windows can have different periods, indicators, experts, trading panels, etc...
Moving through his/her Watch list, a trader an see the full image of his/her strategy in all windows.
A lot of traders use 1
The SetkaMT5 Expert Advisor is the MetaTrader 5 version of the Setka Expert Advisor which is designed for MetaTrader 4. This Expert Advisor has been written in MQL5 for the MetaTrader 5 Platform.
Run the EA and it will create a grid of orders. Orders are created in both directions with a step that can be set in the EA properties. The number of limit and trend orders can also be set manually.
Once the total profit reaches a predetermined value (you can specify it in the EA settings), all orders
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
Robust median Renko style indicator for creating custom charts resembling Median Renko, Mean Renko, Turbo Renko and Better Renko candles as well as vanilla Renko with wicks plus PointO charts. This all in one package provides all of the signals needed by day traders, scalpers and even long term traders.
The indicator is an overlay on the main chart so it is possible to utilize one-click trading and order manipulation directly on the custom charts. Visual order placement is a
Fast Copy MT5 allows you to copy trades between different MetaTrader 5 (netting)(hedge) and MetaTrader 4 accounts in any direction and amount, quickly and easily (without loading the system).
Any type of copying is available
MT4 → MT5 MT4 → MT4 MT5 → MT5 MT5 → MT4
* For the MetaTrader 4 terminal — Fast Copy MT4
* For the MetaTrader 5 terminal — Fast Copy MT5
** Before the purchase, you can test the program by downloading the free demo versions — Fast
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
This indicator is based on Bollinger Bands indicator. It helps user clearly know the Band is expand or contract.
Tick volume is equal to amount of ticks at the unit of time. There is direct correlation between tick volume and real amount of deals. Every change of the price is a result of a real request to perform a deal. Consequently, fewer requests we have, the less price changes we get, and, as a consequence, tick volume is smaller.
In this case, when big amount of requests appear on the market, price changes happen more often. Big tick volume appears. Tick volume is an important indicator of trad
Monitoring and Trend Analysis
This product shows the trend strength levels based on 16 standard indicators, time periods and currency groups.
Depending on the current trend, the indicator colors change from green to red, allowing you to see the full picture.
Whatever your trading method and strategy are, you should always know, in which direction you are trading and what the probability of the trend change is. This indicator will help you answer these questions by calculating the
FULL Automatic is a fully autonomous trading robot for MetaТrader 5 without configurable parameters.
It is similar to SAFE Automatic robot intended for traders having no knowledge of trading basics. It works in Low, Medium, High and Extremal trading modes.
The EA applies modified versions of well-known strategies, including Elliott waves, following a trend, half-pyramiding, scalping, speculative trading with a double deposit protection. The EA switches the strategies automati
This version of the Traders Dynamic Index has the redrawing of the historical data eliminated, the algorithm calculation speed optimized, more external parameters for a more precise adjustments, and its functionalities extended: added the selection of the initial oscillator and the smoothing methods of the averages.
Mode Osc - estimation oscillator selection; Period Osc - the calculation period of the oscillator used; Price Osc - applied price for the oscillation calculati
The main purpose of the indicator is to detect and mark trade signals on the histogram of the Awesome Oscillator according to the strategies "Trading Chaos, second edition" and "New Trading Dimensions".
The indicator detects and marks the following trade signals:
"Two peaks" - Divergence. The signal "Second wise-man" - third consequent bar of the Awesome Oscillator after its color is changed. The histogram crosses the zero line. The signal "Saucer".The indicator includes a signal block th
This is the Famous Timing Indicator
You can now use the most famous Timing indicator on the planet.
Millionaire Mostafa Belkhayate earned his reputation by using this specific indicator to validate the entry signals supplied by his also famous Center of Gravity indicator on the Forex market. I spent hours, days, weeks to decrypt the formula and now it is finally available to you.
New and Unique for MetaTrader 5
Timing will give you perfect validations for your entry signals. It is the first
This indicator extracts a trend from a price series and forecasts its further development. Algorithm is based on modern technique of Singular Spectral Analysis (SSA). SSA is used for extracting the main components (trend, seasonal and wave fluctuations), smoothing and eliminating noise. Does not require the series to be stationary, as well as the information on presence of periodic components and their periods. It can be applied both to price series and to the data of other indicators.
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
This is an utility for automatic scaling of a chart and making at least 140 bars visible in it. This is necessary for a correct wave analysis according to the Bill Williams' strategy "Trading Chaos". The utility can be used on any timeframe available in МetaТrader 5.
It draws a vertical line through the first bar the calculation starts from. This line allows you to see the probable starting point of the wave sequence along with a sufficient number of bars displayed in the chart. It also makes t
The indicator is intended for determining the spread and swap size, the distance for setting stop orders and stop losses from the current price allowed and the risk per 1 point in the deposit currency.
The indicator informs a trader about possible additional expenses and profits connected with transferring a position to the next trade session of the financial instrument. It also informs about the spread size and the distance of pending orders, stop loss and trailing from the current price. In a
Does not support openning multiple 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
Cluster analysis of volumes is now available in MetaTrader 5!
The YuСlusters indicator is a professional tool for analyzing the trading volumes. The cluster graph is plotted based on tick data. For the exchange financial instruments these are the volume, type and price of a deal. For the Forex instruments - the real or tick volume (depending on the broker) and Bid price.
There are 6 criteria of cluster generation:
Time interval, the criterion is set in seconds. Price range, the criteri
Reverse TradeCopier Follow can copy trades from an account that is running Reverse TradeCopier Source.
Copies trades from one source (master) account to multiple following (slave) accounts. Allows investor (read only) password for source (master) account. There are no complicated settings and input parameters, everything is easy. Works with different brokers. Works with different quotes symbols (EURUSD_FX, eurusd_m, etc.). Can copy orders from 4-digit quotes platform to 5-dig
Does not support openning multiple 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 Butt
How to use Pair Trading Station
Pair Trading Station is recommended for H1 time frame and you can use it for any currency pairs. To generate buy and sell signal, follow few steps below to apply Pair Trading Station to your MetaTrader terminal.
When you load Pair Trading Station on your chart, Pair Trading station will assess available historical data in your MetaTrader platforms for each currency pair. On your chart, the amount of historical data available will be displayed for each currency
This panel represents a demo account for binary options. It will catch an interest of those who start working with binary options and want to practice on a demo account. It will also spark an interest of those who use Meta Trader 5 to get signals for binary options. You can test any strategy using this panel. It supports any currencies available in your terminal. The panel is also very compact, and you can move it to any spot on your chart window.
Now you do not need to look for a broker with a
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
This is an open interest indicator for MetaTrader 5. It fixes open interest value once per minute and writes it to the file (on your PC). The product works on any timeframe but only with exchange instruments.
Percent Crosshair is a powerful and easy percentage measure tool.
Measure the chart percentage very quick! Don't waste your time anymore!
Just attach the Percent Crosshair indicator in the chart, select crosshair mode at toolbars or press "Ctrl+F" and start using the crosshair as you always do! The percent measure will be next to the indicative price.
Customize your indicator the way you want!
There are 4 entry parameters:
Positive % color: set the desired color when % is positive. Negat
All traders using VSA realize the importance of the volume. Unfortunately, tick and spot volumes are not suitable for these purposes.
I have conducted mathematical calculations and managed to trnsform the price into the volume that is close to the futures one by its ratios. Now, you do not have to wrestle with the question of where to obtain the volume data. Besides, you will be able to use the currency pairs having no futures at all. With RealVolume, you do not need to remember data on each ti
Three variables are available for every strategy, any one of them can be disabled, their period can be changed.
type_order=ORDER_FILLING _FOK - order filling type.
ReverseTrade=false — trades opens in reverse direction if true. ExitOnBar=true — trades close on each bar only. spreadcover=false — Spread you pay includes in profit trades. It's like trade with zero spread but you should remember that it can decrease exact match between tester's result and live one. It
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.