GRADIENT IN SMA
Forums › ProRealTime English forum › ProOrder support › GRADIENT IN SMA
- This topic has 5 replies, 4 voices, and was last updated 5 years ago by
GraHal.
-
-
05/23/2020 at 4:47 AM #132914
I would like to code a rough gradient in a moving average. My clumsy idea was to try code the SMA, must be higher than SMA of 5 periods ago plus a value, which is X below.
123indicator5 = Average[C](close)indicator6 = Average[C](close)c3 = (indicator5 > indicator6[5]+X)Above not working.
Help appreciated
05/23/2020 at 6:32 AM #132916Try
1c3 = (indicator5 - indicator6[5]+X)This could also help https://www.prorealcode.com/reply/70279/
05/23/2020 at 12:00 PM #13293605/23/2020 at 1:42 PM #132945The best way to measure a gradient is with a ratio of y and x.
12345c = 100x = 5y = average[c] - average[c](close[x-1])Ratio = (y/x)Negative ratio results are a downward sloping MA and the lower the number the steeper the angle. Positive ratio results are an upward sloping MA and the greater the number the steeper the angle.
05/23/2020 at 1:48 PM #132947If you convert it to a percentage of the average p bars back then it is even more usable.
123456p = 100x = 5y = average[p] - average[p](close[x-1])Ratio = ((y/x)/average[p](close[x-1]))*100return ratio2 users thanked author for this post.
05/23/2020 at 4:03 PM #132959Above added as Log 217 here …
-
AuthorPosts
Find exclusive trading pro-tools on