Strategy not placing trades in backtest
Forums › ProRealTime English forum › ProOrder support › Strategy not placing trades in backtest
- This topic has 12 replies, 6 voices, and was last updated 5 years ago by
steynpj.
-
-
07/11/2020 at 5:51 PM #139029
Not placing any trades in back testing.
Y: long sMA
C1 and C2 : sma turning up
C3 and C4 : sma turning down
X : numerical value if difference between current sma and sma 40 periods ago123456789101112131415161718192021222324252627282930313233DEFPARAM FLATBEFORE = 060000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 220000X = (average[Y,0] - average[Y,40])// Conditions to enter long positionsindicator1 = Average[A]indicator2 = Average[A]c1 = (indicator1 > indicator2[1])indicator3 = Average[A]indicator4 = Average[A]c2 = (indicator3[1] < indicator4[2])IF c1 AND c2 AND X > C THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to enter short positionsindicator5 = Average[A]indicator6 = Average[A]c3 = (indicator5 < indicator6[1])indicator7 = Average[A]indicator8 = Average[A]c4 = (indicator7[1] > indicator8[2])IF c3 AND c4 AND X < -C THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Stops and targetsSET STOP pLOSS DSET TARGET pPROFIT EThank you
07/11/2020 at 6:52 PM #13903207/11/2020 at 7:04 PM #13903307/11/2020 at 8:25 PM #13903507/11/2020 at 9:06 PM #139038If C=condition (say Close > close[1]) how can X be > or < ?
07/12/2020 at 3:51 PM #139087steynpj – Please give your topics more meaningful titles otherwise we end up with a forum full of ‘Help needed’ topics! I have changed your topic title. Also do not post your question/comments within the PRT code box. Only put actual code in the code insertion box. I have edited your post to tidy everything up.
07/12/2020 at 6:39 PM #13909207/13/2020 at 8:40 AM #13911207/13/2020 at 9:21 AM #139120It’s the other way round with AVERAGE. The first parameter is the PERIODS, the second one, optional, is the average type.
40 is not supported. Read official documentation for allowed types.
07/13/2020 at 9:25 AM #139122Line 5 should read:
1X = (average[Y,0] - average[Y,0][40])1 user thanked author for this post.
07/13/2020 at 2:57 PM #13916407/13/2020 at 3:31 PM #139169Thank you, @robertogozzi for the clarification, my mistake, shame on me. Btw, just my 2 cents, I think could be easier if author just do the GRAPH on several variables to understand where is the problem. As the code is not complete and some typo, then we keep guessing.
07/13/2020 at 3:45 PM #139171 -
AuthorPosts
Find exclusive trading pro-tools on