Hi guys and thank you for reading my thread.
I am very new to automated trading and have been spending time on the MQL5 website reading articles. I have also been reading through the MQL4 book. I think I understand the content reasonably well so far and have had a go at creating dummy "alert type" scripts and EAs to start my learning. Being in the initial phases of learning Im finding that the more I read the more questions I have about MQL4! My problem is that I have a very specific query to which I think I am unlikely to find the answer in the book or on the forums, and wondered if I could take some advice to make sure that my project "gets off on the right foot".
I am using the MT4 client. My MT4 client is (or will be) subscribed to a third party EA through the Tools ---> Options ---> Signals Tab. The client then automatically places copy/mirror trades based on instructions that come from the signal. My understanding is that these signals are not "attached" to a particular chart and the signal can give an instruction to buy or sell any currency pair at any time.
I wish to write two programs that do two different tasks. Lets call them program A and program B.
The intent of Program A is that every time an instruction comes from the third party signal to buy or sell whether its opening and order or closing an order, the program will detect that a change to the status of open orders has occurred, and will send a record of the latest action to a text file or excel spreadsheet with basic info about that order (i.e. datetime stamp, currency pair, open/close price, volume).
The intent of Program B sounds a little trickier (to me at least!). I would like that when an instruction is received from the signal to open a new buy or sell position, the MT4 client logs every tick (or maybe the price at 1 second intervals, or whatever) until the order is closed. Each datapoint would contain basic info such as the datetimestamp (or time since position was opened), the current price, etc. The objective of the program is to get those date-time stamped price values into a text file or Excel spreadsheet and I would imagine this can either be done "tick-by-tick" whilst the code is running, or can be accumulated by the program whilst it is running and then gets dumped all in one go when the position is closed.
My problem is that according to the MQL4 book, only 1 EA can be running on a client at a time. To me, this means that having a program that constantly checks over and over to look for new positions that are open or closed cannot be run as an EA every tick as the client will already be subscribed to a third party EA via the signals tab. If I run the program as a script my understanding is that it only runs once and so it wont really be repeatedly checking for new positions.
I wonder if the solution involves a script with some kind of loop so that the code runs every second (or whatever), and checks for changes in currently open positions and also stores/posts any data to the log files for any positions that are open.
Would it be possible for any experienced MQL4 coders to comment on the above and perhaps offer any pointers or advice so that I start off on the right lines? I am a complete rookie and know only what I have read/learnt from the internet over the last few days so please go easy on me!
In addition to the above, how much should I expect to pay if I wanted to commission an experienced MQL4 coder to help me develop programs to achieve parts A and B above?
Kind regards and thank you for any assistance that can be provided. As the saying goes - "there's nothing more dangerous than a little bit of knowledge"!
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
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
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
Easy Order is an Expert Advisor allowing you to enter any type of trade with one click based on your RISK preferences.
You can choose to enter a trade and automatically calculate your lot size based on how much of your account you want to risk. Risk is calculated based on your Stop Loss placement. You can use a fixed lot size if you don't want to use risk based calculation of lot size. Your previous setting of risk based or fixed lot size remains saved for your next use of this Expert Advi
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:
Fast Copy MT5 allows 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
MT5 —> MT5 MT5 —> MT4 MT4 —> MT5 MT4 —> MT4
* For any interaction with the MT4, it is necessary to additionally install Fast Copy MT4
One tool for sending and receiving transactions: [master] > [slave] operation mode can be selected 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.
This indicator allows you to enjoy the two most popular products for analyzing request volumes and market deals at a favorable price:
Actual Depth of Market Chart Actual Tick Footprint Volume ChartThis product combines the power of both indicators and is provided as a single file.
The functionality of Actual COMBO Depth of Market AND Tick Volume Chart is fully identical to the original indicators. You will enjoy the power of these two products combined into the single super-indicator!
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
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
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
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
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
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
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 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 main purpose of the indicator is to detect and mark on a chart the following trade signals described in "New Trading Dimensions":
Bullish and bearish reverse bars with angulation (including squat). Bars in the green and red zones according to the histogram color of Awesome Oscillator and Accelerator Oscillator. Bars in the grey zone, when the Awesome Oscillator and Accelerator Oscillator histograms below these bars have opposite directions. Blue squat bars on chart independent of the
The indicator displays the current market information about the recent trades (their direction and volume).
BackColor - general background color of the indicator; AboveAskBackColor - background color of the line with information about the last trade in case it was performed at the price above Ask; AboveAskFontColor - color of the text entered in the line with information about the last trade in case it was performed at the price above Ask; AtAskBackColor - background color of the
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
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 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
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
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.
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
DeltaVolumeDistribution indicator can be considered as the fusion of the DeltaVolume and TradeSizeDistribution indicators.
This indicator, inspired by the MarketDelta-family charts, computes the net difference between trades occurring at bid and at ask, while trades occurring between bid and ask quotes are not computed. The indicator plots the resulting DeltaVolume as a unique distribution plot.
With the DeltaVolumeDistribution indicator you will actually be able to see the order flow entering
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 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
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
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
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
My problem is that according to the MQL4 book, only 1 EA can be running on a client at a time.
Not true, you can only have 1 EA running per open chart.
Thank you for your response GumRai. How do the EAs that are running on charts compare to the EA that I am subscribed to? Does it mean that if I am receiving a signal via the Tools ---> Options (Signals Tab) then I have to open a chart and attach an EA to it for every possible currency pair for which the EA signal I am receiving could open a trade? I hope my question makes sense!
Thank you again for your response.
Thanks JD4. So does that mean I should write a script that runs in an infinite loop to do "part A" - i.e. a script that loops over and over to check whether any orders have been opened, closed, cancelled, etc, and if a trade is opened it attaches an EA to the chart which has an order open, and that EA runs an records ticks to a CSV file until the script tells it to unload? :)
Thank you again for your help!
No, infinite loops are usually bad ideas. Write an EA, they are designed to be "active" all the time. Code it to read your order states you want to monitor. I am not sure if you can write an EA to open a script when certain conditions are met or not though. It seems like a bunch of coding, but I supposed, provided you can open a script from an EA, that you could code your overwatch EA to open scripts under certain conditions, and then if the script is directed to attach EAs to charts, to do that.
A simpler thought on this is why not just write an EA that does all the things you want in one, and attach it to the chart or charts and leave it on them? Code your EA to record only if those conditions are met. But as far as the ticks, MT doesn't use real ticks, according to posts I have seen. The lowest they use is the data from the minute TF and calculate everything else from that. I have tried to find the post where I outline my theory on how they do it, but did not find it yet.
Edit: I found the post (https://www.mql5.com/en/forum/156166) where I proposed my theory, keep in mind that this is only a guess. I do not know specifically how MQ calculates the tick values.
Thanks JD4. I think Im "almost there". Regarding the overwatch EA (as you put it) - I am struggling to understand how that fits in with MT4. Must an EA must always be attached to a chart? So would that mean my "overwatch" EA is just attached to any random chart just as a place to run? If I have one or more charts open with EA's attached to them, does this conflict in any way with receiving signals via the Tools ---> Options ---> Signals tab?
Thanks for your patience!
For an EA to function, from my understanding, it does have to be attached to a chart. I would think that the best place would be the chart for the code pair it is supposed to be working with. As far as signals go, those are basically copied trades from the signal source. I do not know if they would interfere with your EA(s) or not. I am still learning to code MQL myself, and am far from an expert on it. All I have down so far is the general ideas on most of the stuff.
Also, after going back and re-reading your OP, I noticed you are (or were) reading from both MQL 4 and 5. You need to be careful with this, because MT4 cannot use EAs built for MT5 (which uses the MQL5 language). There is a similarity between the 2 since MQ updated MQL4, but you need to be sure you are using MQL4 code when building your MT4 EA. The same goes for MT5 using MQL4, you can't do it. The code needs to be MQL5.