Screener unknown error
Forums › ProRealTime English forum › ProScreener support › Screener unknown error
- This topic has 4 replies, 3 voices, and was last updated 8 years ago by Nicolas.
-
-
10/20/2016 at 8:40 PM #15237
Hi guys,
Ive written this code and I can’t see anything wrong with it but the screener output doesn’t like it since it just returns my whole list.
Can anyone see what is the problem with my code? also if I remove the first timeframe it works, but i’ve used code with dual timeframes before and it worked fine.
thanks
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768TIMEFRAME(1 minutes)ma20 = ExponentialAverage[20](close)ma50 = exponentialaverage[50](close)ma100 = ExponentialAverage[100](close)ma200 = exponentialaverage[200](close)ma10 = (ma20 crosses over ma50)ma20 = (ma20 crosses over ma100)ma30 = (ma50 crosses over ma100)ma40 = (ma50 crosses over ma200)ma50 = (ma20 crosses under ma50)ma60 = (ma20 crosses under ma100)ma70 = (ma50 crosses under ma100)ma80 = (ma50 crosses under ma200)Bull0 = ma10 or ma20 or ma30 or ma40Bear0 = ma50 or ma60 or ma70 or ma80TIMEFRAME(5 Minutes)ma20 = ExponentialAverage[20](close)ma50 = exponentialaverage[50](close)ma100 = ExponentialAverage[100](close)ma200 = exponentialaverage[200](close)ma1 = (ma20 crosses over ma50)ma2 = (ma20 crosses over ma100)ma3 = (ma50 crosses over ma100)ma4 = (ma50 crosses over ma200)ma5 = (ma20 crosses under ma50)ma6 = (ma20 crosses under ma100)ma7 = (ma50 crosses under ma100)ma8 = (ma50 crosses under ma200)Bull = ma1 or ma2 or ma3 or ma4Bear = ma5 or ma6 or ma7 or ma8rise2 = summation[1](Variation(close))>=0.5fall2 = summation[1](Variation(close))<=-0.5rise3 = summation[2](Variation(close))>=0.5fall3 = summation[2](Variation(close))<=-0.5//1%rise11 = summation[5](Variation(close))>=1fall11 = summation[5](Variation(close))<=-1rise22 = summation[1](Variation(close))>=1fall22 = summation[1](Variation(close))<=-1rise33 = summation[2](Variation(close))>=1fall33 = summation[2](Variation(close))<=-1rise44 = summation[3](Variation(close))>=1fall44 = summation[3](Variation(close))<=-1rise55 = summation[4](Variation(close))>=1fall55 = summation[4](Variation(close))<=-1Rises5 = rise2 or rise3Rises1 = rise11 or rise22 or rise33 or rise44 or rise55Falls5 = fall2 or fall3Falls1 = fall11 or fall22 or fall33 or fall44 or fall55screener [Rises5 or rises1 or falls1 or falls5 or bull or bear or bull0 or bear0] (rises1 or falls1 as "1% = 1")10/21/2016 at 9:12 AM #15258Well, there are a lot of “or” statements conditions, it is difficult to know why you have this problem. Obviously, because of the OR conditions, seems normal to me that you get a lot of results here. It is also difficult to know what condition has fired the screener result to debug it 🙂
1 user thanked author for this post.
10/21/2016 at 9:16 AM #1526010/21/2016 at 10:36 AM #15264Hi, don’t know about same moving averages used in both timeframes if you wanted different ones, this depends on your choices, but from a coding point of view, if we take a look just at first timeframe only, we can see you first define ma20 in line 2:
1ma20 <span class="token operator">=</span> <span class="token indicators">ExponentialAverage</span><span class="token punctuation">[</span><span class="token number">20</span><span class="token punctuation">]</span><span class="token punctuation">(</span><span class="token keyword">close</span><span class="token punctuation">)</span>and then you use this same ma20 name for storing a condition (0 or 1) value in line 8
1ma20 <span class="token operator">=</span> <span class="token punctuation">(</span>ma20 <span class="token keyword">crosses over</span> ma100<span class="token punctuation">)</span>so later when you reach your lines 12 and 13, the ma20 used in (ma20 crosses under…) is no more the exponential moving average, but just the 0 or 1 value stored in line 8
same thing with ma50 defined twice in line 3 and line 12, then becoming just 0 or 1 instead of an exp moving average in lines 14-15
You probably want to rename your conditions ma10 to ma80 in lines 7 to 18 with something different from “ma…” to avoid any confusion between a condition and a moving average
Problem doesn’t seem to repeat itself in second timeframe because there you used ma1 to ma8, so no double roles with 2 different definitions for ma20 and ma50 there. However, might be worth renaming ma1 to ma8 in lines 27 to 38 with same type of name you choose to rewrite ma10 to ma80 in lines 7 to 18 not to mix up conditions and moving averages
10/21/2016 at 2:13 PM #15276 -
AuthorPosts
Find exclusive trading pro-tools on