A trader on the desk who can code

This is what I’m talking about.

The cover story of Advanced Trading Magazine for June 2013 is titled “Key Skills for Success” and describes how the trading job description has changed over the last few years.  Traders are increasingly expected to know a bit more about automated systems.  That means that programmers who trade and traders who program are in high demand.

From the article: “In the future, you might want a trader on the desk who knows how to code and program.”
— Joan Stack, Ohio Public
Employees Retirement System

The article is spot on, and very timely for the programmer/trader’s line of work.

 

 

Seasonality trading system

Here’s more about Howard Bandy’s book Quantitative Trading Systems by Howard Bandy.

This stuff is amazing.  I’m reading the section on Seasonality Systems, and Bandy has a trading system that just buys an asset (stock, currency, etc), the same trading day each month, holds it for two days, and then sells it.  And it makes money.  Holy Cow!  The program lets you find the best trading day for various stocks, and I back-tested a number of stocks, as well as the EUR/USD forex, and a good number of them make a profit, including the Euro.

How can this be?  Can this really that simple?  I’m doing more testing on this idea, and if it really works, I’ll put this into a real trading system, and put it out there on a demo account.  Stay tuned.

Seriously, I’m spending hours studying trading systems and complex algorithms, and they do just as well as buying a stock and selling it 2 days later?  We’ll see.  This needs further investigation.

 

New to trading? Try the Combo system

If you are new to trading, and want to get started in the right direction, I would highly recommend The Combo Course by Jennifer Thornburg.

Jennifer does an excellent job of teaching all of the basics to get you started, and then details about each aspect of the trading system, from indicators, timing, market direction, and variations of the system.

She holds webinars and Q&A sessions periodically, and is very approachable if you have questions or need something explained.

 

Good clean code

I like good clean code.  More organization is better. More space is (usually) better.

If you are writing code, remember that the code needs to be readable by humans.  The compiler couldn’t care less what the code looks like, as long as it is syntactically correct.  It’s the poor humans who have to read your code that appreciate organized, easy to read content.

Here’s an example:

for(int i=lmt; i>=0; i--)
 {         sigbuf[i] = a*macbuf[i]+alpha_1*slbuf[i+1];   }

It’s syntactically correct, but, well, hard to read, to put it nicely.

Better:

for (int i=limit; i>=0; i--)
{
     SignalLineBuffer[i] = (alpha * MACDLineBuffer[i]) + (alpha_1 * SignalLineBuffer[i+1]);
}

Even if you don’t know what this code does, the second example is something you can easily see what the parts are.

The best book on this subject is Code Complete, by Steve McConnell.  Every programmer should have this book nearby.

 

Trader Tech Talk 003: Getting Started With Trading System Development

In Episode 3, John gives an overview of the process of developing a trading system.  Each step along the process is discussed, including:

  • The Basics of Trading (for those who have never traded before)
  • A description of a simple trading strategy
  • A quick overview of currency trading
  • Using Metatrader 4 as a platform for developing a trading system
  • Backtesting your strategy to see if the concept is profitable

Here’s an example of a candlestick chart:

chart-example

Here’s a look at the rising price and falling price candles:

candle-types

Here is the sample program that John discusses.  Note that this program will do anything useful; it is just a sample for you to see how Metatrader code looks.

//+------------------------------------------------------------------
 //|                                                       Sample.mq4
 //|                                   Copyright 2013, John Verbrugge
 //|                                    http://www.tradertechtalk.com
 //+------------------------------------------------------------------
 #property copyright "Copyright 2013, John Verbrugge"
 #property link      "http://www.tradertechtalk.com"
extern int HighMAPeriod = 20;
extern int LowMAPeriod = 5;
// Module Variables
bool MovingAvgLinesHaveCrossed = false;
//expert initialization function
int init()
{
 return(0);
}
// expert deinitialization function
int deinit()
{
 return(0);
}
// expert start function
int start()
{
 // set up moving averages
 double HighMA = iMA(NULL,0,HighMAPeriod,0,0,PRICE_HIGH,0);
 double LowMA = iMA(NULL,0,LowMAPeriod,0,0,PRICE_LOW,0);
// Set of moving averages to use for detecting a cross
 double PrevHighMA = iMA(NULL,0,HighMAPeriod,0,0,PRICE_HIGH,0);
 double PrevLowMA = iMA(NULL,0,LowMAPeriod,0,0,PRICE_LOW,0);
// Check to see if the lines have crossed
if ((PrevHighMA > PrevLowMA) && (HighMA < LowMA))
{
   MovingAvgLinesHaveCrossed = true;
}
if ((PrevHighMA < PrevLowMA) && (HighMA > LowMA))
{
    MovingAvgLinesHaveCrossed = true;
}
if (MovingAvgLinesHaveCrossed)
{
    OrderSend("EURUSD",OP_BUY,1.0,MarketInfo("EURUSD",MODE_ASK),0,0,0,"Just a test",99999,0,Green);
}
return(0);
}