Hi everyone, I have been trying to learn MQL coding for the last few months, but the more I learn by myself and with no one to assist me and guiding me, I have reached no where.
I wish to create a simple EA, Moving average EA where a SMA period 10 crosses over/under a SMA period 50. It should open the trade only once every time the condition is met, NOT opening multiple orders or continues to open orders once the condition of cross over has happened.
Can someone please assist me with this simple EA please? I would appreciate this immensely. Please ask if you need more info or do not understand and can assist please.
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 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 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.
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
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 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
Energy line is calculated similar to kinetic energy in physics: E = (mv^2)/2. Tick volumes (money stock) are used as mass, while price rate of change (ROC) is used as velocity.
Energy direction (positive or negative) is defined by ROC direction.
Chaikin Volatility (CHV) indicator is additionally used. Since the volatility starts increasing before the price actually moves, CHV notifies of the increased market activity in advance. Calculations result in the energy release, which usually occurs b
Unique "scalping" trend indicator with the feature of multi-layered smoothing of the resulting lines and a wide selection of parameters. It helps determine a probable change in the trend or a correction virtually near the very beginning of the movement. The toggled intersection arrows are fixed and appear at the opening of a new bar, but, with enough experience, it is possible to look for entry opportunities as soon as the indicator lines intersect at the unfinished bar. The signal appearance li
Pivot Points MT5 is a universal color multicurrency/multisymbol indicator of the Pivot Points levels systems. You can select one of its three versions: Standard Old, Standard New and Fibo. It plots pivot levels for financial instruments in a separate window.
The system will automatically calculate the Pivot Point on the basis of market data for the previous day (PERIOD_D1) and the system of support and resistance levels, three in each.
A user can choose colors for the indicator lines.
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
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
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
Trade in the opposite directions with HedgeTerminalApi library!
HedgeTerminalApi is a program interface allowing you to use HedgeTerminal virtualization technologies in your robots and scripts. With HedgeTerminalApi, you are able to trade in the opposite directions when two or more trading algorithms occupy opposite positions on a single symbol. The library allows robots to track their positions even if these positions overlap entirely or partially. Moreover, with this library, you are able to
The EA trades a fast broker against a slow broker.
Open two terminals for the Expert Advisor operation.
The Fast Broker is a quotes source.
The Slow Broker receives quotes and opens positions.
Expert Advisor Settings
Only a few settings matter when configuring the Expert Advisor.
save_quotes — suggests the action mode: false - as a Fast Broker or true - as a Slow Broker. symb_name — instructs the EA to send quotes to other broker for the selected currency pair. SL – sa
AIIV EURUSD - Active Index Inflection Values EURUSD
The Indicator Shows:
The intensity and the direction of the movement of USD. The intensity and the direction of the movement of EUR. The inflection value of EURUSD.This indicator allows determining a state of inflection on the market with a delay of one-two candlesticks and a 60% precision (precision depends on the chart timeframe - the higher the timeframe, the more precise is the forecast).
AIIV is a series of indicators of inflection
The Trend Strength is now available for the MetaTrader 5.
This indicator determines the strength of a short-term trend using the tick history that is stores during its operation.
The indicator is based on two principles of trend technical analysis:
The current trend is more likely to continue than change its direction. The trend will move in the same direction until it weakens.The indicator works on the M30, H1, H4 and D1 timeframes.
It is easy to work with this indicator both in manu
Trade Channel Indicator DCMV
The DCMV Indicator calculates the following Channel characteristics:
Channel Bounds (for TP and SL). It's assumed that price will never go outside the channel.Center Line of the Channel.Settlement price (with probability 90% the price will return to this line).Reference line (used for detection of trend).Upper and Lower breakborder. Used for generation of trade signals: channel breakout (trend strategies), false breakouts (flat strategies).Usage:
The indicator pro
The PZ Day Trading indicator detects reversals in a zig-zag fashion, without repainting or backpainting. Based on breakouts of variable lengths, the indicator uses only price action to pick trades and reacts to the market very fast. The positional accuracy of its signals offers huge opportunity for profits, easily up to 80% winners.
Amazingly easy to tradeChart statistics will help you to optimize your tradingIt works on every single timeframe without fine tuningThe indicator analyzes its own q
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 is a classical trading strategy, which falls into the category of breakout systems. They form support and resistance levels, which temporarily limit further price movement. When the price breaks down the support level or breaks up the resistance level, there emerges a strong momentum in the breakout direction, which allows to make profit on strong price movements with moderate risk.
To create the strategy, we used historical data with the quality of history of 99.9%.
It uses filtration o
Main Pivots is an indicator which looks for pivots points on preset intervals (days, weeks, months, years, etc.). Then all extreme points are checked for splice and consistent support and resistance lines are formed. These lines are useful for detecting the best pivot points.
It finds a pair of pivot lines for each interval which correspond to Low (support line) and High (resistance line) of the price movement on the interval. Difference between these lines represemt the price movement for the
The indicator is based on the digital window-sinc filter with an excellent frequency division. Due to this property you can get a very smooth indicator line.
The indicator has three lines: the central line indicates the main trend direction and the "fair" price, the other two lines show the price range. When the central line is read, it is recommended to buy from the bottom line and close a position above the central line. When the line is blue, do the opposite - sell from the upper line and cl
The TrendX is a technical indicator which allows to determine not only the movement direction of the market, but also to identify the flat areas.
It is based on the CCI indicator and a combination of price patterns.
The indicator works on all symbols and timeframes.
Two parameters allow to customize the indicator as needed, PERIOD is the period of CCI and T_Value is the significance of the trend.
DCMV Trade Channel Oscillator
The indicator calculates the values of DCMV trade channel oscillator:
Trade channel width. The value of trade channel depends on the trend (it increases at start of the trend and has the maximum values at end of the trend). The value of trade channel decreases at flat movement. The lowest values of channel width indicates the high probability of the very strong price movement.
The +DC line shows the "bulls" power. The -DC line shows the "bears" power. Th
This is a convenient tool for measuring the number of points between prices. It support magnetizing to OHLC prices. Calculates profit considering specified lot size and spread (optionally). It counts the number of bars between specified point and the time difference between them. Calculates the slope angle from the horizontal position. Unneeded parameters can be hidden. It does not occupy much space when inactive.
Once you add the indicator on the chart, Ruler caption will appear (according to
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:
The indicator consists of the two parts – entry system displayed on the chart and currency power analyzer.
The analyzer can take on values from 0 to 3:
the higher the value, the stronger the currency; the smaller the value, the weaker the currency; average values of the indicator suggest that the currency is in flat.Recommendations on usage:
Buy if Trader Dream shows Buy signal and the analyzer shows the currency's strength (the value exceeds 2). Sell if Trader Dream shows Se
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
Is position management time consuming? The Trade Manager Pro EA performs an automatic and flawless position management for you, avoiding human errors and enhancing your trading activity. It represents a ten-fold increase in trading productivity!
Capital preservation is top priorityLet profits run without your attentionEnjoy risk-free trades as soon as possibleIt trails the stop-loss automatically
Initial SL and TP are also automatic
The EA performs the following tasks
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
can I ask the ways you are trying to learn MQL? I am asking so because I am getting the impression that you are going directly to MQL, which is normally not getting you anywhere, since there are not any real documents out there to help us about. So, ff that is the case, I recommend to start learning the basics of C programming, as C is a nice and simple language and MQL is based on it; you may consider C++ to be the same, as we can usually see the C/C++ writing, but make no mistake, C++ is different from C. Of course you can pick whatever language you like, but you can either grab a book, e-book or online resources and get your self started right on
Interesting. I always thought that MQL4 was based on C++
Is C easier to learn?
I learned MQL4 from "The Book" and reading posts here and asking the odd question. I had no knowledge of C or ++.
I would like to learn more in order to be able to use structs and stuff in the include files etc as I simply don't understand them.
I have looked at some online resources for learning C++, but haven't made any progress. Possibly because I have been unable to find a way to incorporate C++ int mq4 immediately.
So you think that it may be worth my while checking out C?
The little knowledge I have about MQL code is through online EA Building sites and learning from the code that is generated and through online courses on YouTube, yet the very little basic knowledge I have gathered made me more confused every time I tried to manipulate or change codes and adding to it which resulted in just non functioning EA's with no result at the end of the day.
So can anyone assist me in this simple EA please?
This is the code that I have, but when I test this, it creates endless orders after each order has closed after profit taking. I just want this code to do the 1 order when the conditions are met, thus when the 2 MA's crossover.
Please can someone assist me with this, I would appreciate it.
extern int MagicNumber=10001;
extern double Lots =0.1;
extern double StopLoss=50;
extern double TakeProfit=50;
extern int TrailingStop=50;
extern int Slippage=3;
// expert start function
if(Digits==3 || Digits==5) MyPoint=Point*10;
if( TotalOrdersCount()==0 )
if((iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0)>iMA(NULL,0,50,0,MODE_SMA,PRICE_CLOSE,1))) // Here is your open buy rule
if((iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0)<iMA(NULL,0,50,0,MODE_SMA,PRICE_CLOSE,1))) // Here is your open Sell rule
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
if (OrderMagicNumber()==MagicNumber) result++;
Of course it does.
bool sigCurr = iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0)<iMA(NULL,0,50,0,MODE_SMA,PRICE_CLOSE,1);
bool sigPrev = iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,1)<iMA(NULL,0,50,0,MODE_SMA,PRICE_CLOSE,2);
if(sigCurr && !sigPrev)
Hello :) If you ask me, C is ok because it is simple for the most part, I mean there is not much nonsense in there. In the other hand, I find C++ to include alot of that, but of course it is up to everyone to pick up what s/he likes. But as a fact, since C++ is "bigger" it is normally more difficult to get started with (and I am not even sure that there is any significant knowledge to gain from that :) ) Regarding MQL, is as similar to C as C++ is; the syntax is C, which is a significant part of each language and then MQL adds or removes some parts here or there. MQL5 is even more C++ like, in the sense that it is more object oriented but MQL4 looks more like C
ok, since everyone on this topic is totally off the topic and now talking about code without sticking to the original issue, where can I learn this C code you are talking about?
Change your iMA functions to look at bar 1 and 2 in stead of bar 0 and 1.
Bar 0 is the current bar and therefore changing constantly. The moving average can move up and down the other one multiple times while it is still in the make.
If you look at bar 1 and 2 this won't happen as they are already closed and "set in stone".
So in stead of using: