Hi All
I’ve been working on a code using an EMA crossover strategy on the 1 hour Wall St Index to enter long.
The code has produced good results on optimising, but then I noticed it didn’t enter where I would have expected on some trades on back tested results.
I then did a comparison with a very simple crossover entry built from the wizard & stripped back my code to match it. On back testing I found that the two codes had different results and different entry positions.
I’ve loaded up the two test codes:c(my striped down original code). & SAW DOW 1Hr Long Test 02 (My comparison code built in the wizard).
I’ve also loaded up the equity curve and market entry screens and the results for both codes.
Can anybody explain this as if it is a backtesting anomaly I am wary of the results produced!
Thanks in advance
Steve
PS Please note the codes below are the entry only section of the overall codes, but all the backtesting and results are from running these two same codes
//-------------------------------------------------------------------------
// Code Name: SAW DOW 1Hr Long Test 01 - Striped Original Code
//-------------------------------------------------------------------------
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions to enter long positions
indicator1 = ExponentialAverage[28](open)//x1//28
indicator2 = ExponentialAverage[44](open)//x2//44
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 AND not daysForbiddenEntry THEN
BUY 1 PERPOINT AT MARKET
ENDIF
//set stops & Targets
SET STOP pLOSS 185//x//185
SET TARGET pPROFIT 125//y//300
//-------------------------------------------------------------------------
// Code Name: SAW DOW 1Hr Long Test 02 - Wizard Generated Code
//-------------------------------------------------------------------------
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions to enter long positions
indicator1 = ExponentialAverage[28](open)
indicator2 = Average[44](open)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 AND not daysForbiddenEntry THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 185
SET TARGET pPROFIT 125
The second one uses a simple moving average (not exponential) for “indicator2”, while the first code uses EMA.
Topic moved to ProOrder forum which is for strategy topics. You posted in the ProBuilder forum which is for indicators. I think that is a better place for it as although your question is about an indicator it is about an indicator in a strategy!
Hi Nicolas – thanks for that, I must have been going code blind!!!
Steve