How to start with MetaTrader and forex, the beginning - page 15

Sergey Golubev
Moderator
123036
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 4 Platform build 1260

MetaQuotes, 2020.01.23 09:54

The MetaTrader 4 update will be released on Friday, January the 24th, 2020. The update provides bug fixes and stability improvements.

The new version will be available through the Live Update system.


Sergey Golubev
Moderator
123036
Sergey Golubev  
Simple Advisor with Stop Loss and Take Profit- go the post #21 to download.

Forum on trading, automated trading systems and testing trading strategies

How to start with MQL5

Vladimir Karputov, 2020.03.05 18:31

Simple Advisor with Stop Loss and Take Profit

An example of a simple Expert Advisor that opens one position with the indicated Stop Loss and Take Profit.


To give a trade order to open a position with Stop Loss and Take Profit, you need to calculate these levels:

Stop Loss and Take Profit


Variables declared at the global program level (in the 'header' of the adviser):

To send trade orders, use the CTrade trading class

#property version   "1.000"
//---
#include <Trade\Trade.mqh>
//---
CTrade         m_trade;                         // object of CTrade class
//--- input parameters


Input parameters:

I always prefer to set Stop Loss and Take Profit levels in whole types (more precisely in 'ushort')

//--- input parameters
input ushort   InpStopLoss          = 150;      // Stop Loss, in points (1.00045-1.00055=10 points)
input ushort   InpTakeProfit        = 460;      // Take Profit, in points (1.00045-1.00055=10 points)
input ulong    InpMagic             = 200;      // Magic number
//+------------------------------------------------------------------+
//| Expert initialization function                                   |


OnTick:

Using PositionsTotal, we determine if there are positions or not. If there are no positions, first we get fresh prices (we do this with SymbolInfoTick). Attention: this is a very simple version - there are not many necessary checks!

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if(PositionsTotal()==0)
     {
      MqlTick tick;
      if(SymbolInfoTick(Symbol(),tick))
        {
         double sl=(InpStopLoss==0.0)?0.0:tick.ask-InpStopLoss*Point();
         double tp=(InpTakeProfit==0.0)?0.0:tick.ask+InpTakeProfit*Point();
         m_trade.Buy(0.01,Symbol(),tick.ask,sl,tp);
        }
     }
  }


Result:

Simple Advisor with Stop Loss and Take Profit


Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator
  • www.mql5.com
MetaQuotes Programming Language 5 (MQL5), included in MetaTrader 5 Client Terminal, has many new possibilities and higher performance, compared to MQL4. This article will help you to get acquainted with this new programming language. The simple examples of how to write an Expert Advisor and Custom Indicator are presented in this article. We...
Sergey Golubev
Moderator
123036
Sergey Golubev  

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners 

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners

This article is aimed at beginners who wish to learn how to write simple Expert Advisors in the new MQL5 language. We will begin first by defining what we want our EA (Expert advisor) to do, and then move on to how we want the EA to do it.

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
  • www.mql5.com
This article is aimed at beginners who wish to learn how to write simple Expert Advisors in the new MQL5 language. We will begin first by defining what we want our EA (Expert advisor) to do, and then move on to how we want the EA to do it. 1. Trading Strategy It will monitor a particular indicator, and when a certain condition is met (or...
Sergey Golubev
Moderator
123036
Sergey Golubev  

Projects assist in creating profitable trading robots! Or at least, so it seems


Creation of a trading robot always starts with a small file, which then grows in size as you implement more additional functions and custom objects. Most of MQL5 programmers utilize include files (MQH) to handle this problem. However, there is a better solution: start developing any trading application in a project. There are so many reasons to do so.

Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
Documentation on MQL5: Language Basics / Preprocessor / Including Files (#include)
  • www.mql5.com
with the content of the file WinUser32.mqh. Angle brackets indicate that the WinUser32.mqh file will be taken from the standard directory (usually it is If the file name is enclosed in...
Sergey Golubev
Moderator
123036
Sergey Golubev  

And just to summarize everything -  - 

============

1. User Memo

Forum on trading, automated trading systems and testing trading strategies

How to Start with Metatrader 5

Sergey Golubev, 2016.12.30 17:26

Just some reminding about how to insert code to the post (for new users/newbies) -read here, and read whole the article:MQL5.community - User Memo
============

2. How to make a search on the forum/mql5 portal

3. Summaries

3.1. How to Start with MT5, a summary ! (incl the previous thread:How to start with MetaTrader and forex, the beginning) 
    MetaTrader 4 Help - Client Terminal – User Guide 
    MetaTrader 5 Help - Trading Platform — User Manual

3.2. All (not yet) about Strategy Tester, Optimization and Cloud 

3.3. MetaTrader 5 Python User Group - the summary 

3.4. ASCTREND SYSTEM summary (incl 2 good EAs)

3.5. BRAINTRADING SYSTEM HowTo

3.6. PriceChannel Parabolic system (incl 2 versions of the EA)

3.7. Market Condition Evaluation (2 EAs were created)

3.8. Ichimoku

3.9. Financial and trading videos - Table of Contents

3.10. All about Calendar tab and Macro Economic Events

3.11 All about MQL5 Wizard : create robots without programming

============

4. First key article:
MetaTrader 5 - More Than You Can Imagine! 

============

5. The second key article:
Limitless Opportunities with MetaTrader 5 and MQL5 

============

6. How to add the broker to MT5:

6.1. MetaTrader 5 Help - Open an Account

6.2. MetaTrader 5 Android OS Help - Opening a Demo Account 

6.3. MetaTrader 5 iPhone/iPad Help - Connecting to an Account and Opening a Demo Account

============

7. Signals

============

8. Market

============

9. MQL5 VPS for MT4/MT5

9.1. How to subscribe to VPS https://www.mql5.com/en/forum/187872#comment_4851530 

9.2. You can move your VPS subscription from one account to another 
https://www.mql5.com/en/forum/172120#comment_4166892

9.3. MQL5 VPS description
https://www.mql5.com/en/forum/172553#comment_4185979 

9.4. Monitor VPS 
https://www.mql5.com/en/forum/188920#comment_4800677 

9.5. Synchronize - 
https://www.mql5.com/en/forum/211508 

============

10. Brokers

10.1. Find a Server by the Broker's Name:
https://www.mql5.com/en/forum/9950/page88#comment_3981953  
https://www.mql5.com/en/forum/214820

10.2. Help for beginners
https://www.mql5.com/en/forum/214904

10.3. US brokers
https://www.mql5.com/en/forum/12423/page500#comment_4736742

============

11. Promotion:
https://www.mql5.com/en/forum/9950/page88#comment_3982032  
https://www.mql5.com/en/forum/9950/page88#comment_3982030  
https://www.mql5.com/en/forum/9950/page88#comment_3982036  

============

12. Freelance, decompilation, the rules, examples of the decompiled code:
https://www.mql5.com/en/forum/203200 
All Freelance links/information - this post.

============

13. General rules and best pratices of the Forum

13.1. Thread with the discussion

13.2. Forum rules

============

14. The thread about threadswhat's going around the forum everywhere  
Good thread if you are looking for something new and modern (and free one)

============

15. MT5, mql5, mql5.com suggestions for improvement thread

============

16. How to subscribe to topic or  invite a person into the topic - the thread

============

17. I just downloaded MT5 I am not sure how to pull up Cryptos - the thread.

============

18. Club of telepaths - the post in eng forum and the thread in rus thread. 

============

19. How to host an automated trading robot on Metatrader (how to attach EA to the chart for trading)
https://www.mql5.com/en/forum/238562#comment_7158340 

============

20. Automatic translation feature
https://www.mql5.com/en/forum/13348 

============

21. How to download free Indicator and instal it on Metatrader
https://www.mql5.com/en/forum/261958 

============

22. How to attach indicator to the chart; how to change the settings of the indicator which was attached to the chart
https://www.mql5.com/en/forum/344569

MetaTrader 4 Help
MetaTrader 4 Help
  • www.metatrader4.com
For making a decision to trade, reliable on-line information is necessary. For that, quotes and news are delivered at the terminal in the real-time mode. On basis of on-line delivered quotes, it is possible to analyze markets using technical indicators and line studies. Expert advisors allow to work off routine of observing markets and the own...
Sergey Golubev
Moderator
123036
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

MetaTrader 5 for iOS overhauled — swipes, new sections and color schemes

MetaQuotes, 2020.06.29 15:18

We have gathered feedback from MetaTrader 5 iOS users and overhauled the application in terms of appearance and functionality. The mobile platform is now more powerful, more efficient and more user-friendly.

MetaTrader 5 for iOS overhauled


Sergey Golubev
Moderator
123036
Sergey Golubev  

And I am posting this suggestion all the time on the forum. It is related to the Signals, the Market, and to the Freelance as well - 

Forum on trading, automated trading systems and testing trading strategies

...

Sergey Golubev, 2020.01.16 06:35

There is one rule which some people follow:
subscribe to the signal or create an order in Freelance or purchase the product from the user/seller/coder/provider you know in person or you know by activity on the forum.

Because if you purchased something so I may ask:
"Do you know the seller in person, or you are familiar with him on this forum?"
If you say: "Not" so it will be very strange case for me ...

Just my optinion.

----------------

There are a lot of professional and honest users/coders on the forum, and some of them are very active on this forum helping to the other people and replying on the forum posts/requests.

https://www.mql5.com/en/job/new

 

But if you select "anyone" (any coder which you do not know in person or you do not know him on this forum) so - it is your choice (and we call it as "Russian roulette" in my country).

----------------

Always choose the person you know in this forum (who is very active here), and you will have much less problems with anything.

Just my opinion sorry (because I am not a coder, and I am using Freelance as well).

Creating an Order - Freelance service at MQL5.com
Creating an Order - Freelance service at MQL5.com
  • www.mql5.com
Order a technical indicator, trading robot or any other trading application from Freelance
Sergey Golubev
Moderator
123036
Sergey Golubev  

It is good to read (to know) -

Forum on trading, automated trading systems and testing trading strategies

Where Do I start from?

Sergey Golubev, 2018.09.20 15:43

Use tips - the instruction about HowTo

=========

----------------

----------------

----------------


Sergey Golubev
Moderator
123036
Sergey Golubev  

Quotes section Widget (I want to install a widget)

----------------

Forum on trading, automated trading systems and testing trading strategies

New MQL5.community section: install trading data widgets and share charts

MetaQuotes, 2020.07.23 11:07

The website features the new Quotes section containing the relevant data on futures, financial and stock markets. It allows the monitoring of data from leading world exchanges and liquidity providers in real time. By utilizing such data, traders can stay up to date with any changes and take the correct trading decisions.

Study price history and matrix, track rate fluctuations, compare symbols and convert currencies.

Currencies

Currencies

Monitor prices in the Overview — each symbol features bid and ask prices, as well as a stylized chart. To view a detailed symbol data just click on it.

The Forex Matrix tab allows users to select several currency pairs and monitor changes on a single screen. Clicking an intersection point of the two currencies containing a price, will open a detailed symbol chart.

The Currency Converter tab allows conversion of one currency to another. Choose the current rate or any other value from the history.

Charts

Charts

Working with charts section — traders are able to use and improve ready-made charts or create their own. Feel free to scale charts and apply any indicators for technical analysis.

Select Share in the upper menu to share your trading ideas with colleagues. You will get a direct link to the chart or an html code that can, for instance, be added to a blog.

All the changes you make on the chart are saved, while your recipient is able to edit them. This is convenient for team meetings or visual demonstrations.

Widgets

Widgets

Install Overview, Forex Matrix or Currency Converter in your website or social network — select the appropriate widget type, size and language, as well as default currencies. Make your web resource more attractive to visitors and retain visitation loyalty.

It is free of charge. The data is updated automatically. No ads are displayed on widgets.

I want to install a widget


Symbols and Quotes
Symbols and Quotes
  • www.mql5.com
Currencies Rates