Automated strategy (with EMA and RSI crossovers) not running at all
Forums › ProRealTime English forum › ProOrder support › Automated strategy (with EMA and RSI crossovers) not running at all
- This topic has 2 replies, 3 voices, and was last updated 5 years ago by Nicolas.
-
-
12/20/2018 at 6:55 PM #87539
Hi,
This is my first post ever and I am a total noob on PRT/PRC so hopefully you’ll forgive me any faux pass.
I have spent last couple hours trying to build an automated strategy suing assisted creation in PRT (demo account).
I am trying to open longs when:
- current price is above 20 period EMA,
- 5 EMA crosses over 20 EMA
- recent 5 period RSI is above previous 5 RSI
- 5 RSI is above 14 RSI
- current price is above previous price
and
I am trying to open shorts when:
- current price is below 20 period EMA,
- 5 EMA crosses under 20 EMA
- recent 5 period RSI is below previous 5 RSI
- 5 RSI is below 14 RSI
- current price is below previous price
I’ts pretty much reverse.
Closing of longs and shorts happens when some of the above conditions cease to exist.
When I am trying to run the strategy (Gsys) backtesting the results, the window loads and it seems like it’s running, equity curve window opens, but there are no results. It’s basically “N/A” everywhere.
As if nothing has been triggered.
it’s the same when I try to run the same strategy on live data (in demo) – in normal trading.
PRT code snippet12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 063000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 211500// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 064000timeEnterBefore = time >= noEntryBeforeTime// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 203000timeEnterAfter = time < noEntryAfterTime// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsc1 = (close > close[1])indicator1 = ExponentialAverage[5](close)c2 = (close CROSSES OVER indicator1)indicator2 = RSI[5](RSI[14](close))indicator3 = RSI[14](close)c3 = (indicator2 CROSSES OVER indicator3)indicator4 = RSI[5](RSI[14](close))indicator5 = RSI[5](RSI[14](close))c4 = (indicator4 > indicator5[1])indicator6 = ExponentialAverage[5](close)indicator7 = ExponentialAverage[20](close)c5 = (indicator6 CROSSES OVER indicator7)indicator8 = Average[100](close)c6 = (close > indicator8[1])indicator9 = SAR[0.02,0.02,0.2]c7 = (indicator9[2] > close[2])indicator10 = SAR[0.02,0.02,0.2]c8 = (indicator10[1] < close[1])indicator11 = SAR[0.02,0.02,0.2]c9 = (indicator11 < close)IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 AND c7 AND c8 AND c9) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THENBUY 25 SHARES AT MARKETENDIF// Conditions to exit long positionsc10 = (close[1] < close[2])indicator12 = RSI[5](RSI[14](close))indicator13 = RSI[5](RSI[14](close))c11 = (indicator12 < indicator13[1])indicator14 = RSI[5](RSI[14](close))indicator15 = RSI[14](close)c12 = (indicator14[1] CROSSES UNDER indicator15[1])indicator16 = ExponentialAverage[5](close)indicator17 = ExponentialAverage[5](close)c13 = (indicator16[1] < indicator17[2])c14 = (close < close[1])IF c10 AND c11 AND c12 AND c13 AND c14 THENSELL AT MARKETENDIF// Conditions to enter short positionsc15 = (close < close[1])indicator18 = ExponentialAverage[20](close)c16 = (close CROSSES UNDER indicator18)indicator19 = ExponentialAverage[5](close)indicator20 = ExponentialAverage[20](close)c17 = (indicator19[1] CROSSES UNDER indicator20[1])indicator21 = RSI[5](RSI[14](close))indicator22 = RSI[14](close)c18 = (indicator21[1] CROSSES UNDER indicator22[1])indicator23 = RSI[5](RSI[14](close))indicator24 = RSI[5](RSI[14](close))c19 = (indicator23 < indicator24[1])IF (c15 AND c16 AND c17 AND c18 AND c19) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THENSELLSHORT 25 SHARES AT MARKETENDIF// Conditions to exit short positionsindicator25 = RSI[5](RSI[14](close))indicator26 = RSI[14](close)c20 = (indicator25 CROSSES OVER indicator26)indicator27 = RSI[5](RSI[14](close))indicator28 = RSI[5](RSI[14](close))c21 = (indicator27 > indicator28[1])c22 = (close > close[1])indicator29 = ExponentialAverage[20](close)c23 = (close CROSSES OVER indicator29)IF c20 AND c21 AND c22 AND c23 THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pLOSS 20 pTRAILING 20SET TARGET pPROFIT 4012/20/2018 at 7:47 PM #87545It’s due to the numerous Crosses over and under. I’ve just had your code executing trades by replacing crosses over by > and crosses under by <.
I would leave at least one crosses over and one crosses under.
It is not often that 3 x crosses over or 3 x crosses under will occur in one bar?
12/21/2018 at 10:53 AM #87550 -
AuthorPosts
Find exclusive trading pro-tools on