The Perfect Workstation for Traders

Walk and Trade

Walk and Trade

via: 8th light blog

Popularity: 1% [?]

Tagged with:
 

Designing a Simple Strategy and Introduction to Pseudo Code

Today we will be looking at designing a simple strategy and we will also start to write some pseudo code in MetaEditor. This is of course a multi part tutorial series and if you have not read the previous articles I suggest you do so before moving on to this article. In the previous article on Expert Advisors (EA) and indicators we touched on the different ways we can automate trading, today we will focus on Expert Advisors (EA).

 

Strategy Design

Designing a trading strategy could be the focus of whole encyclopedia, what we discuss here will simply be a quick overview. In it’s simplest from a trading strategy is simply  a set of predefined rules for executing trading decisions. By using an automated trading strategy emotional bias is removed. There are several different types of trading strategies that have been used over the years and usually fall into one of the following categories: 

  • Fundamental Analysis based systems.
  • Technical Analysis Based systems.
  • Volatility based systems
  • Mean reversion based systems.
  • Trend Following systems.

Building a Trend Following Based System

We will be building a Trend Following system, this will be a very basic system and will help highlight the development process. When developing a trading system it is very tempting to try and re-invent the wheel, however we will start with a tried and tested system that is publically available. The trading system we will be implementing is the original Turtle Trading System and you will need to download a copy of the rules in order to continue with the tutorial.

Learning to Write Pseudo Code

Before reading any more make sure you have printed out and read through the original Turtle Trading System Rules document. This step is very important as the only way to learn this materiel is by taking action and carrying out the steps outlined.

STOP!

Now we can get on with our discussion of pseudo code. When it comes to writing computer programs or in this case automated trading systems translating English into programming code can be fraught with danger. Pseudo Code on the other hand refers to a more structured English for describing a process or program. It is important that you learn to write quality pseudo code as it will make a big difference when you come to coding your system your self or hiring a programmer.

There are many benefits in writing your algorithms or trading logic in pseudo code these include:

  • You will gain a detailed understanding of the program or algorithm you are developing.
  • Errors in logic picked up early.
  • Not constrained by a single programming language.

Below is a brief example of pseudo code:

IF movingAverage1 == movingAverage2 THEN
    SEND buyOrder
END IF

Structured Pseudo Code

In order for us to write quality code we have to take a step back and think about what it is we are actually trying to achieve. Rather then using a trading example we will use an example that everyone is familiar with. Think about the process of going to the shop and buying 1 item let’s say it is milk. What I will ask you to do is sit down and write a step by step process that you could give to a an alien that describes the process in as much detail as possible.

STOP!

Do not move on until you have done this.  Below is the first iteration of solving the get milk problem:

Get into the car –> Start the car –> Drive to the closest shop that sells milk –> Get Out of Car –> Lock Car

Enter shop –> Locate milk –> Determine quantity –> Pay for milk –> Locate car –> Unlock Car –> Drive home.

As you can see if you think about the steps required to carry out this task it is much more complex then first thought. Let’s try and make this a bit more detailed iteration two:

DEFINE approxMilkCost

DEFINE moneyInWallet

 

IF moneyInWallet < approxMilkCost THEN

           CALL enterCar WITH keys

           CALL driveTo WITH bank

           CALL leaveCar

           CALL getMoneyFromBank WITH accountDetails

           CALL driveTo WITH shop

           CALL leaveCar

ELSE

          CALL enterCar WITH keys

          CALL driveTo WITH shop

          CALL leaveCar

ENDIF

 

enter shop

CALL locateItem WITH milk

CALL payForItem WITH money

leave shop

CALL enterCar WITH keys

CALL driveTo WITH home

CALL leaveCar

You can quickly see that by using a more formal language it breaks down complex tasks into simple steps. If we wanted to write a program to solve this problem we would probably go through several more iterations of pseudo code before actually starting coding. I have created a PDF file and have uploaded it so you can fully understand the pseudo code presented and can practice writing some pseudo code for yourself.  In the next article we will be looking at writing our trend following system out in pseudo code so make sure you review everything presented here.

Popularity: 15% [?]

Tagged with:
 

The Best Economic Calendars – Keep Up To Date With The Latest Announcements

As traders of any market it is important to know what is going on in the world. By this statement I don’t mean you have to sit glued to CNBC or some other brain-dead news service. Every day there are announcements and releases of economic data that have the potential to move markets. Today I thought I would share with you the economic calendars I use and some tools I use for analysis.

Economic Calenders

When it comes to economic calendars you will find an assortment of them on-line. There are only two online calendars that I use on daily basis. They are the Forex Calendar @ Forex Factory and Bloomberg Calendar the screenshots of these calendars shown below:

Forex Factory - Calendar

Bloomberg Economic Calendar

Out of these two calendars my favourite would have to be the Forex Calendar it has more features and has a much easier workflow then Bloomberg. 

Forex Calendar Features

The first thing you will want to do with both these calendars is adjust your time zone. After I have done this I like to get out my trading notebook and I enter  the announcements that will be relevant to me on that given day. To get more detail about a specific announcement simply click on the detail button. The detail window gives you the following information:

  • Source
  • Measures
  • Usual Effect
  • Frequency
  • Next Release
  • FF Notes
  • Why Traders care
  • Derived via
  • Acro Expand
  • History
  • Related items

The screenshot below shows the Forex Calendar detail feature in action:

Forex Calendar Detail The other unique feature the Forex calendar has is the ability to chart historical release data. Like the detail feature you simply click on the chart icon and an interactive chart will be generated within the same window.  The image below shows the chart feature in action:

Forex Calendar chart

Software Tools

I use the free tool FF Calendar to news software as it provides an easy way for me to build a database of future and historic news events on my local computer. This is very handy for some system design work I do. The screenshot below shows my news events history database:

History databaseOnce my database is populated I can then run a script that overlays each of the economic events on the appropriate chart. This allows for me to graphically view the impact if any on the underlying markets. The screenshot below shows the auto generated chart content on the EUR/USD 1 minute spot chart:

Chart Overlay In my next post I will talk about the classic reference book that I often refer to surrounding news releases The Secrets of Economic Indicators: Hidden Clues to Future Economic Trends and Investment Opportunities.

Popularity: 3% [?]

Tagged with: