Moving averages as hozontal lines possible?
Forums › ProRealTime English forum › ProBuilder support › Moving averages as hozontal lines possible?
- This topic has 13 replies, 3 voices, and was last updated 3 years ago by Marius.
-
-
08/11/2021 at 9:26 AM #175083
Hello all,
I use moving averages in my charts and since the normal view of the three curves (20,50,200sma) bothers me, I would like to know if it is possible to map the moving averages as horizontal lines in the chart, so that they only show the current value of the SMA.
08/11/2021 at 9:40 AM #175086Hi, here you go, with examples of colours to recognise the lines (now that they’re all horizontal), and an example of optional dotted line in case you don’t want full lines:
1234567891011defparam DRAWONLASTBARONLY=truesma20=Average[20](close)sma50=Average[50](close)sma100=Average[100](close)DRAWHLINE(sma20) coloured(0,0,255)DRAWHLINE(sma50) coloured(0,255,0) style(dottedline,1)DRAWHLINE(sma100) coloured(255,0,0)return1 user thanked author for this post.
08/11/2021 at 10:19 AM #17508808/11/2021 at 10:40 AM #17508908/11/2021 at 10:51 AM #175092Sure, after line or dottedline, choose a number between 1 (thin) and 5 (thick), for example:
1234567891011defparam DRAWONLASTBARONLY=truesma20=Average[20](close)sma50=Average[50](close)sma100=Average[100](close)DRAWHLINE(sma20) coloured(0,0,255) style(line,5)DRAWHLINE(sma50) coloured(0,255,0) style(dottedline,3)DRAWHLINE(sma100) coloured(255,0,0) style(line,2)return1 user thanked author for this post.
08/11/2021 at 10:53 AM #17509309/22/2021 at 11:38 AM #178110Hi JC,
thank you again for your help to display the moving averages as horizontal lines.
I would like to see the actual value of the lines – so my quesion to you is: Is there a solution to display the value of the lines on the price axis?
Thanks a lot!
09/22/2021 at 2:03 PM #178116Note on the price axis, but in the chart with some DRAWTEXT instructions:
1234567891011121314defparam DRAWONLASTBARONLY=truesma20=Average[20](close)sma50=Average[50](close)sma100=Average[100](close)DRAWHLINE(sma20) coloured(0,0,255) style(line,5)drawtext(sma20,barindex+10,sma20,sansserif,standard,20) coloured(0,0,255)DRAWHLINE(sma50) coloured(0,255,0) style(dottedline,3)drawtext(sma50,barindex+10,sma50,sansserif,standard,20) coloured(0,255,0)DRAWHLINE(sma100) coloured(255,0,0) style(line,2)drawtext(sma100,barindex+10,sma100,sansserif,standard,20) coloured(255,0,0)return1 user thanked author for this post.
09/22/2021 at 2:45 PM #17811909/22/2021 at 6:13 PM #178126Hi Nicolas,
II have configured the code so that I now have20,50 and 200sma as horizontal lines in the chart.
Unfortunately, the values are not displayed on the price axis, but only on the lines.
I would prefer to see the values of the sma only on the price axis. Do you have the time to help me again?
Thank you very much!BTW: When I first used your code one of the lines displayed the value on the price axis with the same colour of the line.
1234567891011121314defparam DRAWONLASTBARONLY=truesma20=Average[20](close)sma50=Average[50](close)sma200=Average[200](close)DRAWHLINE(sma20)coloured(0,0,204) style(line,2)drawtext(sma20,barindex+15,sma20,sansserif,standard,15) coloured(0,0,204)DRAWHLINE(sma50)coloured(204,0,0) style(line,2)drawtext(sma50,barindex+15,sma50,sansserif,standard,15) coloured(204,0,0)DRAWHLINE(sma200)coloured(0,102,51) style(line,2)drawtext(sma200,barindex+15,sma200,sansserif,standard,15) coloured(0,102,51)return09/23/2021 at 8:36 AM #178156Hello,
to see sma’s values on price axis, while still keeping only horizontal lines of latest value visible rather than history:
1234567891011121314defparam DRAWONLASTBARONLY=truesma20=Average[20](close)sma50=Average[50](close)sma200=Average[200](close)DRAWHLINE(sma20)coloured(0,0,204) style(line,2)//drawtext(sma20,barindex+15,sma20,sansserif,standard,15) coloured(0,0,204)DRAWHLINE(sma50)coloured(204,0,0) style(line,2)//drawtext(sma50,barindex+15,sma50,sansserif,standard,15) coloured(204,0,0)DRAWHLINE(sma200)coloured(0,102,51) style(line,2)//drawtext(sma200,barindex+15,sma200,sansserif,standard,15) coloured(0,102,51)return sma20 coloured(0,0,0,0), sma50 coloured(0,0,0,0), sma200 coloured(0,0,0,0)1 user thanked author for this post.
09/23/2021 at 8:46 AM #17816209/23/2021 at 8:49 AM #17816509/23/2021 at 8:58 AM #178167 -
AuthorPosts
Find exclusive trading pro-tools on