PDA

View Full Version : Could anyone back test this code for me?



Broncosvr
07-18-2018,
I've just discovered automated trading and have been trying to put a system together on IG (http://www.trade2win.com/boards/autolink.php?id=10&forumid=164&script=showthread)'s Prorealtime. This one is for US30 on M30 T/F and is simplicity itself.

// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
x=45
y=54
a=40
b=48
// Conditions to enter long positions
indicator1 = ExponentialAverage[x](close)
indicator2 = ExponentialAverage[y](close)
c1 = (indicator1 CROSSES OVER indicator2)

IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF

// Conditions to exit long positions
indicator3 = ExponentialAverage[x](close)
indicator4 = ExponentialAverage[y](close)
c2 = (indicator3 CROSSES UNDER indicator4)

IF c2 THEN
SELL AT MARKET
ENDIF

// Conditions to enter short positions
indicator5 = ExponentialAverage[a](close)
indicator6 = ExponentialAverage[b](close)
c3 = (indicator5 CROSSES UNDER indicator6)

IF c3 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF

// Conditions to exit short positions
indicator7 = ExponentialAverage[a](close)
indicator8 = ExponentialAverage[b](close)
c4 = (indicator7 CROSSES OVER indicator8)

IF c4 THEN
EXITSHORT AT MARKET
ENDIF

// Stops and targets
SET STOP pLOSS 75
SET TARGET pPROFIT 150

I can back test to August last year but no further. If anybody could test this going back 5 years or so I would be very grateful. The results so far are pretty good. Any suggestions for improvement are most welcome.http://static2.trade2win.com/boards/images/smilies/thumbsup.gif

buymesoTar
07-19-2018,
Why can't you backtest prior to August? When you say "US30" do you mean the Dow 30? You could download years of historical data on that quite easily (such as Yahoo Finance, for example).

Your algorithm appears to use an (exponential) moving average crossovers to generate buy/sell signals. Yes, that is "simplicity itself." Maybe too simple. If you're going to do algorithmic trading, I suggest reading Ernie Chan's book, "Algorithmic Trading - Winning Strategies and Their Rationale".

Calvinpa
07-20-2018,
I can't back test prior to August because that's as far back as the data goes on my spread bet platform on the 30 minute time frame. Yes I'm referring to the Dow. I think the years of historical data on Yahoo is Daily OHLC, but I will double check. It maybe too simple and that's why I'm trying to back test for a longer period of time.

Charleslype
07-21-2018,
Ten months of 30-minute data should be about 2000 data points, by my calculation. That should be sufficient to back test. If you're not seeing a decent return with backtesting that data set, then it might be best to drop the strategy.