Rookie question — back testing issues
- This topic has 2 replies, 2 voices, and was last updated 9 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
Forums › ProRealTime English forum › ProRealTime platform support › Rookie question — back testing issues
All,
I just started learning the coding, starting with help video example (SMA20/SMA50 cross over system https://www1.prorealtime.com/en/videos_tutorial/140_create_a_trading_system_without_programming-trading)
Entering the same code in testing mode results is a blank report window(attached) 12.0 platform on Windows
The code is below. Any pointers, please
100000
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 171500
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 100000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 163000
timeEnterAfter = time < noEntryAfterTime
// 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 = Average[20](close)
indicator2 = Average[50](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 1 SHARES AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = Average[20](close)
indicator4 = Average[50](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator5 = Average[20](close)
indicator6 = Average[50](close)
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
SELLSHORT 1 SHARES AT MARKET
ENDIF
// Conditions to exit short positions
indicator7 = Average[20](close)
indicator8 = Average[50](close)
c4 = (indicator7 CROSSES OVER indicator8)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pTRAILING 10
SET TARGET pPROFIT 30
Hi Bluemoon,
I think you should change the time unit of the chart on which the system is running from Daily currently to 15 minutes, for example. The code is read at each candle close.
kr