
I will introduce students to the course, to myself, and explain what they will be able to do by the end of the course
A quick talk on visual, auditory and kinesthetic learning. How learning programming is best learned through practice just like math.
I will lead students through installing, then running MetaTrader 4 and MetaEditor.
*Edit: As of mid 2019, Metaquotes removed the download link for MetaTrader 4 from the website page that I showed in my video, which I had made around Jan-Feb 2019. The downloaded installer file might be spelled MT4Setup.exe. However when you install it, the MetaTrader icon on your desktop shows the number "5" in the middle, and MetaEditor 5 shows up on your desktop as well. Showing that its actually the MetaTrader 5 installer disguised as the MetaTrader 4 installer.
Currently you can get the MetaTrader 4 installer from your respective brokers who support MetaTrader 4 trading. Some brokers might have the installer available for download from their website. Others might need you to contact their customer service or set up a demo account with them before you can download their MetaTrader 4 installer. To confirm that you have the correct version. After installing MetaTrader, the MetaEditor should be labelled as "MetaEditor 4" and not "5". Hope this helps to avoid any confusion regarding the software. Wish you Happy learning and Programming!!
By the end of this section. Students would have installed MetaTrader 4 and MetaEditor 4 and be able to run them on their PC/Laptop.
Laying out how I will guide the learner on gradual yet practical coding sections.
From scripts to Indicators to EAs, and what is the objective at the end of this section.
I will walk students through the 3 parts of a basic program, what are variables , custom functions, as well as introducing the 3 common types of programs that we will create in this course. scripts, indicators and Expert Advisors (aka Forex Robots).
I will teach students how to start a script so that we can start coding and how the 3 basic structures will be shown in the script layout.
Lets start coding! I will Introduce variables, comments and walkthrough video 2.mq4 declaration of variables section.
I will go through the main body of the script. It is a more lengthy lecture where I introduce brackets, operations of relation & how to use the help file.
To generate our script we have to compile our codes. And in this lecture I introduce the compilation errors and basic debugging to get a working script.
I will Introduce the layout and objective of section 3. By the end of this section students will be able to build a Pivot Point, Support and Resistance Indicator.
I explain what is the pivot point support and resistance system. Touching a bit on Indicators as well.
I will show the student how to start a new Indicator in MetaEditor. And how we can use simple tools like a notepad to start forming our algorithms.
I will start to talk about our codes in “Pivot SR Indicator.mq4” Also introducing our first extern variable.
Introducing 2 custom functions which we created to delete lines and calculate our Pivot Point values.
To continue describing our custom functions. How we are going to draw the support / resistance lines, and to set their colours.
In this part we will go through functions OnInit, deinit. How OnCalculate replaces OnStart and how deinit executes when we remove the indicator.
We will compile our Indicator and use it on a chart and switch to a few timeframes.
Go through what the student should have achieved by the end of this section.
I will give an overview of this section, such as our trading strategy, pseudocoding our algorithm on a simple notepad. Using custom functions for buy/sell orders and finally backtesting our Forex Robot.
Discuss moving averages and what will be our trading signals.
I will explain how we do pseudocode on a notepad showing how we can form our coding ideas for our EA .
I will show how to start a new EA, and discuss the variables that we will be using.
We will only be using 2 custom functions for buy and sell orders. I will go through how we calculate and declare the variables takeprofit and stoploss, and how the “Point” function works in MetaEditor.
We will continue discussing the 2 custom functions for buy and sell orders. We will go through the variable “ticket”, and explain custom function “OrderSend()”.
In this section there are much more codes to go through in our main body. I will start to discuss how we will get our moving average values and our trading conditions.
We will compile our EA and start our backtesting on MetaTrader 4’s strategy tester
To solve our EA non-stop trading issues. I will discuss why we need additional variables for date and time, so that we can control how frequently our EA trades.
Lets change up some of our extern variables and test our EA on different timeframes.
Congratulations on finally completing our Expert Advisor (Forex Robot). Lets round up what we’ve learnt this section.
You have basically completed all the required sections in order to program your own Forex Robot. The following sections are optional lectures which I talk about risk management and other FAQs.
Risk management is one of the most important skills that either make us a successful trader, or a bankrupt one. I will talk about the rule of 1% to 3%. And how I manage risk when I trade on multiple EAs.
In this section I will show you how I turn losing EAs into possibly profitable EAs, if the spread does not eat all our profits. And how we can use it to hedge as well.
Before coding anything, we will first need to figure out the equation or formula that we will use in our codes. I shall first explain the equation or formula that is used to calculate lot sizes in Forex trading.
To test out the equation, lets try coding a simple script program. We should not code directly into our EA as it might introduce unwanted and complex bugs, and it will be hard to debug as there are many lines of codes in our EA.
Song : Daystar - Shangri-La / https://youtu.be/-J-ey1JZjUE
Our previous script didn't work, as it keeps giving us a result of 0 for our lot sizes. I shall explain how the error occurred and how we can correct it with a simple change in our variable datatype.
Song : Daystar - Shangri-La / https://youtu.be/-J-ey1JZjUE
Since we have tested our codes to work in our script, now lets try inserting the codes into our EA and test it out in the Strategy Tester.
Song : Daystar - Shangri-La / https://youtu.be/-J-ey1JZjUE
The hardest issues to debug are when there are no syntax errors, your program gets compiled and runs, but it doesn't work as intended. This means that there are issues with the programming logic instead of simple syntax errors, and debugging gets quite complicated.
In this video I show my technique of using print statements to check whether certain codes are executed, the values of important variables, and finally OrderSend error codes.
This is a practical course for Forex or Commodity traders who want to learn MQL4 and program their own Forex Robots (aka Expert Advisor for the MetaTrader 4 trading platform). The student is assumed to have basic trading knowledge and knows how to use the MetaTrader 4 platform. This course also assumes the student is a total beginner in programming and is structured in a way to have a gentle learning curve.