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"!
Who will be interested in this product:
those who are used to diversify the portfolio with a large number of pairs. those who work with a large number of orders those who trade news using pending orders (see the "Grid request" tab).The panel is designed to make managing a large number of orders as easy as managing one.
The currency pairs and order types for opening are formed here. The prices and stop levels are set.
User can define the price valu
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
TTMM – "Time To Make Money" – Time When Traders Makes Money on the Stock Exchanges
The ТТММ trade sessions indicator displays the following information:
Trade sessions: American, European, Asian and Pacific. (Note: Sessions are displayed on the previous five days and the current day only. The number of days may change depending on the holidays - they are not displayed in the terminals. The sessions are also not displayed on Saturday and Sunday).
The main trading hours of
Veno EA MT5 is a safe and fully automated medium-term trading robot.
The EA does NOT use hedging, martingale, grid strategies, arbitrage, etc.
Veno Expert System MT5 automatically monitors the appearance of participants with distinct preference towards buying or selling on the market. Trades are conducted on sharp cluster and news based movements of the market. The robot analyzes the market volumes and volatility, and follows strong supply and demand movements. It smoothly sets breakeven level
This software has no equals in the world and represents a universal trade "console" covering trading signals, automated market entry, setting of Stop Loss and Take Profit, as well as Trailing Profit for multiple trades at the same time in a single open window. Intuitive control of the Expert Advisor in "three clicks" ensures a comprehensive use of all its functions on different computers, including tablets PCs.
Interacting with additional signal indicators that mark the chart to give a real mar
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 robot does not trade at night from 10 p.m. to 4 a.m. (server time).
The robot was tested in the special tester on real ticks. Empirical e
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
S2 Trend At Wavelet is designed to eliminate the noises on the Price Chart. A clear picture of the market flow will be seen due to the elimination of the unnecessary variations on the chart.
Capabilities of S2 Trend:
Chart End could be shifted to any desired point by Market End Line; A desired Scale could be used by selecting Scale Menu and the result will be shown on the chart; A separate diagram on the Main Chart could be shown by using Chart window's check box; Graphical representation
This indicator shows how much time is left on the current candle.
You have absolute control over appearance of remaining time label. Also, you can set additional flag to show remaining time in the comment section of your chart and how much time has already passed on the current candle measured in percents.
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
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
The Turtle Trading Indicator implements the original Dennis Richards and Bill Eckhart trading system, commonly known as The Turtle Trader. This trend following system relies on breakouts of historical highs and lows to take and close trades: it is the complete opposite to the "buy low and sell high" approach. The main rule is "Trade an N-day breakout and take profits when an M-day high or low is breached (N must me above M)".
The Turtle Trader legend began with a be
The indicator determines and marks the short-term lows and highs of the market on the chart according to Larry Williams` book "Long-term secrets to short-term trading".
"Any time there is a daily low with higher lows on both sides of it, that low will be a short-term low. We know this because a study of market action will show that prices descended in the low day, then failed to make a new low, and thus turned up, marking that ultimate low as a short-term point. A short-term market high is just
The indicator has standard settings. The new modification of indicator provides special marking of the segment when the moving averages begin to form a cross in one direction or another. The Alligator`s cross indicates that the trend is about to change. Modified Alligator helps traders to determine a trend on a particular timeframe even if the averages are intertwined and have a shift in the future. Direction of a trend is determined by a cross of the averages with a specified marking area on th
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
Investment in the capital markets is risky. Some of transactions are closing with loss, so very important thing is to control risk. There are many tools for risk controlling. One of them is Risk Reward Ratio indicator.
It is used by many investors to compare the expected returns of an investment to the amount of risk undertaken to capture these returns. This ratio is calculated mathematically by dividing the amount he or she stands to lose if the price moves in the unexpected direction (i.e. th
This indicator gives full information about the market state: strength and direction of a trend, volatility and price movement channel. It has two graphical components:
Histogram: the size and the color of a bar show the strength and direction of a trend. Positive values show an ascending trend and negative values - a descending trend. Green bar is for up motion, red one - for down motion, and the yellow one means no trend. Signal line is the value of the histogram (you can enable divergence
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 Spread Record Standart indicator displays spread for each price bar as a bar graph. It uses five variables as spread values:
Spread level at the bar opening; Maximum spread level reached during the bar; Minimum spread level reached during the bar; Spread level at the bar closing; Average spread level within the bar (displayed as a green dot on the corresponding level of the bar)Apart from displaying price bars, SpreadRecord also provides a small built-in panel showing the curre
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
There is Demo version of this panel Dashboard Babon Scalping System MT5 Demo in my product list, please try it out to get familiar with all functionalities for free.
Free version: LINK
MT4 version: LINK
This system basically utilizes TDI, Heiken Ashi Trend, Price Trend on H1 time-frame and TMA on H1&H4 time-frame to generate the trend (big picture). Then the system will zoom in to generate the entry point on M1 time-frame using Babon Slope, M5 TMA, and Ichimoku indicators. The signal will be
FXG_Info – the most important data in one place.
MetaTrader 5 Indicator FXG_Info provides basic statistical information about a particular currency pair. So that in combination with a chart representing currency price it is easy to determine whether the current situation is good for trading. And when you open a position it will clearly show you the current data such as SL, TP, RR. You are not limited to currency. You can use any market which is provided by you broker.
The following information
VirtualTradePad - is a contol panel for working with orders in МetaТrader 5 : buy, sell, buystop, buylimit, sellstop, selllimit, close, delete, modify, tralling stop.
VirtualTradePad won 2nd prize in the "Best Control Panel in the MQL5 Language" Contest.
The panel consists of 5 tabs.
VirtualTradePad PositionsStyle VirtualTradePad Ordersstyle VirtualTradePad SignalsStyleDemo version of the panel - VirtualTradePad LiteProfit or Loss PadINFO PadYou can also try this panel for
EasyPen is designed as beautiful and innovative way to create and manage all your chart analysis, scribbles, notes and more. The app takes advantage of new MQL5 technology to offer an experience unseen in the other apps or in older MQL versions.
An App That Changes Everything
There is no existing drawing app that allows the level of customization that EasyPen offers. Change color of your pen, choose brush size, save drawings, keep drawings attached to specific position in chart, and more. With
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 th
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
This indicator will help you add any custom indicators to a mini chart that is open on the main chart.
When you start this indicator, in the parameter table, you have to choose the name the of mini chart you want to add to the main chart, and you have to choose the symbol, period and coordinates of the minichart on the main chart with X-distance and Y-distance parameters. Then you type the indicator's name (that indicator must exist in the indicator folder already).
If you want, you can choos
This is a panel for controlling the profit/loss in dollars, pips or % of balance. A new function for trailing profits has been implemented.
The panel can be used as a virtual Stop Loss or Take Profit.
It also features the emergency button - CLOSE ALL.
You can also try the full version of the VirtualTradePad for mt5 panel, as well as the Profit or Loss for mt4 panel
Other versions in this collection:
VirtualTradePad for mt5 Digit Market Time Pad Market Time Pad Scalper PadMain f
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 EASIEST way to manage your risk for each trade!
Add the indicator to your chart, configure a risk percentage (of account equity) Enter the number of pips for your stop loss into the text entry field that appears on the chart The position size to take will automatically be updatedThe product features two modes - a compact mode which allows entry of stop loss pips and shows the resulting lot size based on the percent risk setting, as well as an expanded mode that also shows
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.