Skip to main content

Posts

Showing posts from July, 2017

Forex correlation calculation with MQL4

All the functions discussed here are part of the Statistics library available for purchase.



While watching Wimbledon finals yesterday in the UK. I was thinking of all the significant economical events we are going through in Europe, the Brexit, elections etc. and how are the different pairs I am trading got affected. The statistical value which show the significance of the dependency between two products is called Correlation.

According to https://en.wikipedia.org/wiki/Correlation_and_dependence, Correlation can be calculated using the following equation:

Correlation(EURUSD,USDJPY)=Covariance(EURUSD,USDJPY) / STD(EURUSD)*STD(USDJPY)

Correlation ranges between -1, that when EURUSD trends upwards, USDJPY expected to trend downwards. 0, meaning there is no dependency between these currencies at all. Or +1, meaning the currencies are expected to trend in the same direction.

Why would you care?

EURUSD and EURCHF have correlation of -1 in most of the times. Imagine you went long on EURUSD believi…

The MQL4 Lot Size Functions I Use In My Algotrading Code

All the functions discussed here are part of the Common library available for purchase.



The goal of this post is to share with you some functions I am using to verify and manage the lot size I used when opening an order. As mentioned in my home page, I am using proprietary algorithm to trade the 25% cash I don't invest in the permanent portfolio. To achieve that, I programmed an Expert Advisor using MQL language which is running 24/5 and trade 5 currency pairs. In here, you can find the relevant darwin which can be traded as a normal financial product thanks to the Darwinex broker.

Managing Lot Size

As noted in another post about leverage, it is important to keep the leverage / lot size under control. Most common junior mistakes are trading massive lot sizes to gain quick wins, but as soon as the market turns against them, their account is completely wiped out without a chance to react (speaking from experience). So, in this post I will share three functions I am using to verify and …

Swiss Permanent Portfolio Performance H1/2017

The first half of the year is over, time to check the Swiss permanent portfolio performance. As per the definition set by Harry Brown, the permanent portfolio should consist of 4 pillars:


Equities
Bondsbonds.
Gold
Cash


Swiss Permanent Portfolio Version

Using the above template as basis and as explained in here, I split my investment within 3 funds:


AUCHAH - The fund aims to primarily reflect gold's performance, after deduction of the running costs. The fund's assets are exclusively invested in physical Gold.
CSBGC0 - The fund invests exclusively in bonds and other fixed or variable-rate debt instruments and rights, denominated in Swiss francs, of the Swiss Confederation, which are included in the Swiss Bond Index Domestic Government 7+.
SPICHA - The fund's investment objective is to replicate the price performance and returns of the Swiss Performance Index SPI(R). The SPI(R) comprises the about 230 largest stocks in the Swiss equity market.
Cash - Using my own proprietary algorithm …