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);
}

 

Did you enjoy this article?
"Get my free programmer's checklist"
The checklist gives you step-by-step instructions on how to create the perfect automated trading system.

Leave a Reply

Your email address will not be published. Required fields are marked *