MA scan
Forums › ProRealTime English forum › ProScreener support › MA scan
- This topic has 16 replies, 3 voices, and was last updated 5 years ago by JackD.
-
-
10/25/2019 at 4:29 AM #111140
Hi,
I have one more scan that I would like to get some code for.
I would like to create a scan when these 3 moving averages are very tight together (same price) but I wondering is it possible to have a small variable so if they are not exactly the same it will still show results?
Exponential moving average 6
Moving average 10
Exponential moving average 20I have been watching the videos on how to wright simple code but still finding it hard to get my head around it. Is there any other even more basic videos that I can view? just so that I can learn to code as well.
Cheers,
Jack
10/25/2019 at 7:41 AM #111149You need to define what the ‘small variable’ is. In this code it is that the lines are all within a percentage of price.
1234567891011121314percentage = 0.25a = exponentialaverage[6]b = average[10]c = exponentialaverage[20]upper = max(max(a,b),c)lower = min(min(a,b),c)d = ((upper - lower) / close) *100e = d <= percentageSCREENER[e]2 users thanked author for this post.
10/25/2019 at 11:01 AM #11117310/25/2019 at 12:26 PM #111188O I just had a thought. Does this scan for stocks that are layered with the MA’s 6, 10 and 20 (top to bottom)? How can I add it so that it doesn’t have to be any order?
Just that some of the stocks that I have found with the MA’s tight are not coming up on the scan.
Sorry to be a pain.Cheers,
Jack
10/26/2019 at 3:28 AM #11124110/26/2019 at 8:16 AM #111251The screener does not care what order the lines are in. It just checks the distance between the highest line and the lowest line and compares it to price.
What % of price are you testing for? I notice that one of your images has a price of 0.234 so if you are looking for a maximum gap of say 0.25% between the highest and the lowest line then they must be just 0.000585 apart or less.
The other image has a price of 2.950 so they would need to be <= 0.007375 apart.
Try increasing the percentage setting if it is missing stocks that you think it should be detecting.
10/26/2019 at 9:46 AM #111258Don’t really have a specific % in mind just wanted to get all the stocks that had the MA’s really tight together so I could choose which ones I thought had the best set ups.
I increased it all the way up to 20% and still didn’t those ones, looks like it’s only finding the larger cap names. Odd.10/26/2019 at 10:08 AM #11126020% of price would allow the lines to be very far apart indeed!
1 user thanked author for this post.
10/26/2019 at 2:33 PM #11127310/26/2019 at 4:04 PM #111276Add this indicator to any chart as a separate indicator and you can see what the current percentage is as well as the historical maximum and minimum spread of the highest to lowest average.
12345678910111213141516171819a = exponentialaverage[6]b = average[10]c = exponentialaverage[20]upper = max(max(a,b),c)lower = min(min(a,b),c)d = ((upper - lower) / close) *100if c > 0 thenif minapart = 0 thenminapart = dendifmaxapart = max(d,maxapart)minapart = min(d,minapart)endifreturn d as "% MA Zone", maxapart as "max MA spread", minapart as "min MA spread"10/27/2019 at 2:07 AM #11130210/27/2019 at 2:56 PM #111338Both codes above added as Log 183 and 184 to here …
1 user thanked author for this post.
11/01/2019 at 1:19 PM #11182011/01/2019 at 5:34 PM #11184511/01/2019 at 7:10 PM #111857Sorry I was half asleep when I wrote that.
I would like to narrow the range of stocks I am scanning for, stocks that are priced from .05 to 7 dollars or what ever I am wanting to narrow my search.
Hope that makes sense?
Thank you in advance,
Jack -
AuthorPosts