JForex Example: Dual-Timeframe Moving Averages Setup

This post describes the setup for my Dukascopy JForex automated trading strategy in July. Note that this strategy is built for competing in a contest and not for real trading (i.e., its purely a no cost gamble). Here is the step by step process of the setup for a long position:

  1. Determine the current trend by the relative position of current price to its moving average in a higher time frame. In particular, a price above the moving average in the higher time frame is deemed as bullish.
  2. Entry: Price moves above a moving average in the current time frame (red line in Figure 1) with a higher high, low, and close (HLC). As illustrated in Figure 1, the two bars circled.
  3. Exit: Crossing below a regular moving average (blue dotted line).

EURUSD setup

As you can see, the setup itself is simple. Less than a fifth of the source code is devoted to the entry and exit. Most of this strategy involves automated position sizing and risk management to not let profits turn into losses.

The complete source code of this strategy is available in the introductory post.