Skip to main content

Posts

Showing posts from October, 2018

How I make Money trading Forex

Did you know that on average 80% of retail traders lose money when trading Forex?

But, if you've been following my blog, you realized by now that I make my income from trading Forex, and to be specific from trading EURUSD only. This is the only product I trade and live from, which is quite counter intuitive, how is it possible to trade only one product with all it's ups and downs and live from it? In this post, I will explain exactly how I make a living from trading Forex and which traps to avoid.

Still, even that it worked for me and the setup is quite simple, there's no guarantee it will work for you the reader. We are all in a different situations in life, with more or less to risk, knowledge and so on. But still, I suggest to read this post to understand which traps are out there and which path you can follow to avoid losing your money.

The Traps



But first, let's start with the typical pitfalls out there, unfortunately, in some of them I fell myself and lost money:

Buyi…

How I use Properties Files in Expert Advisers

Introduction

The classic way of defining input parameters for an expert adviser is using a variable, for example:
input double Lots=0.01; //Default lots to use
In this case the input variable will hold the default value to use in the expert adviser throughout the execution. If you want to change the value, you’d have to restart the expert adviser to enter the new value.
But, what if you could have avoided restarting the expert adviser, in some cases, the expert adviser is doing something or holding some valuable piece of information which might get lost if you restart it again.

My way of using parameters solves exactly that challenge, in my solution which I will explain later on, I am using properties files and updating the expert adviser on the fly, thus, avoiding the unnecessary restart of the expert adviser.

File Structure

As I am using the plain text files as properties files, the structure is mostly as key=value structure. For example, the Lots input parameter mentioned above will be wr…

MQL Functions to Close All Orders

This code and much utility functions are available for purchase as part of the Common library.



Introduction

It is a common practice in my code to close all the orders once a certain condition is fulfilled. Normally, a profit target is reached, but there could be other reasons. In this post I will introduce some of the functions I am using to perform that. The main  common feature to all of these functions is the counting starts from OrdersTotal()-1 and goes down to 0. This to prevent closing already closed orders as noted in this article - https://book.mql4.com/trading/orderclose.

Functions

Standard

The standard function to close all the orders is simply going through the open ones and close them one by one, starting from the last towards the first:

bool CloseAllOrders(string argSymbol="") export
{
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS) && (StringLen(argSymbol)==0 || StringCompare(argSymbol,OrderSymbol())==0) && (OrderProfit()+OrderC…