MQL4 Tutorial Bootcamp 10 – How to create your first trading logic in Metatrader4

Okay now I would like our little Expert Advisor to really trade. We will define a simple rule here when it’s going up and we have no open trades we want to open a buy trade. So let’s bring up MetaEditor.
We are going to change the logic here to make a decision we will use the IF statement. And if the close prize of the last finished candle is higher than the close prize of the candle before and if Orders Total is less than one open order we want to open a buy-trade. This line might look a little bit confusing basically it tells your broker what kind of order to send, how much and if it should buy or sell. You will learn more about this later on.
In the comment line I would like to have the account balance, and it is calculated with the function Account Balance. Let’s compile the code. Oh we have missed the E and two round brackets. So let’s compile again and everything is okay. Let’s go back to the terminal and see what happens. I would change this one to the candle view and within a minute it should open a trade – but it doesn’t. How come? Well we have made a little mistake but it wasn’t a mistake the compiler could find.
We said we want to open a trade if orders total is below zero! The compiler would never be able to find it because it can only check for syntactical errors. Let’s change it to 1. So now it’s when Orders total is below one and compile it. And here we are: the trade has just been opened.
In the next video we will learn how to back test our Expert Advisor. Back testing is a very fast way to find out if and how it works by using historical data and that will save you a lot of time.

GO PRO IN 12 MONTHS
100 % MONEY BACK GUARANTEE!  
PRECODED SYSTEMS & STRATEGIES!
 FASTER, BETTER, AUTOMATED RESULTS YOU WILL GET NOWHERE ELSE ... 
JOIN TODAY FOR A WHOLE YEAR !