Backtesting – it’s easy!

Ok so today I was playing with the backtesting if the Omar_MACD strategy more and I noticed the difference between the two Moving Averages seem to be different when I backtested multiple times. It turns out that this is because the start date was different. The start date has to be more than n-periods away from the trade to ensure we get a consistent result.

Additionally, the open and close levels alone are not sufficient because it was being checked with crosses. If the lines move apart very slowly then that means eventually the crosses check returns false and we miss a possible trading opportunity.

Adjusted the strategy to open an opposite position when closing a position due to the change in the trend.

Attempted to counter the false signals generated when the market is not very volatile by introducing a lossBuffer variable. If the loss from closing the trade does not exceed the lossBuffer then do not close the trade and wait to see if it comes around anyway.

Optimizing the strategy shows that a fastValue of 6 and a slowValue of 19 produces the best results, probably as it reacts to the more volatile currency pair better. openValue of 10 and closeValue of 0 with a lossBuffer of 10 seems to work best, and for some reason no stop loss. Need to investigate this more.

Lessons Learned

  • Backtesting start date has to be more than n-periods away.
  • Profit = Amount * (1 – PriceBefore/PriceAfter)
  • Micro Accounts – where the LOT SIZE is $1,000 and 1 pip = $0.10 per micro-lot
  • Mini Accounts – where the LOT SIZE is $10,000 and 1 pip = $1.00 per mini-lot, and
  • Standard Accounts – where the LOT SIZE is $100,000 and 1 pip = $10.00 per standard lot.
  • Not sure how to use the StopLoss in conjunction with the lossBuffer but StopLosses should be defined just in case I lose the connection.

Results (Jan 1st 2012 – April 28th 2013)

  • Total profit/loss        1,230.49
  • Total profit of all trades        7,089.44
  • Total loss of all trades        5,858.95
  • Number of trades closed    243
  • Number of long trades        131 (53.9%)
  • Number of short trades    112 (46.1%)
  • Number of profit trades    103 (42.4%)
  • Number of loss trades        140 (57.6%)
Posted in Backtesting, FXCM, MarketScope and tagged , , , , , .

One Comment

  1. Pingback: Is Trading using leverage yield more Return?? | My Investment Articles

Leave a Reply

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