Horizontally shifting a MA in an indicator
Forums › ProRealTime English forum › ProBuilder support › Horizontally shifting a MA in an indicator
- This topic has 6 replies, 4 voices, and was last updated 6 years ago by denmar.
-
-
05/14/2017 at 7:39 PM #35501
Hi Everybody
I wish to include a MA horizontally displaced by n bars in an indicator. I have scoured the manual but it does not include an example that includes this, nor is this option included in the syntax at the end of the manual. If one reads the function help option whilst trying to construct the indicator reference is made to this,again with no example (see attached screen capture). Any help/suggestions greatly appreciated. Thank you.
05/15/2017 at 7:42 AM #35527If you want to draw it on the right of the chart (in the “future”), then it is not possible with code sorry.
If you want to get the value from the moving average from X bars ago, you can, use this kind of code:
example with a 20 period SMA12345X = 10 //you'll get the value of the SMA from 10 bars agosma20 = average[20](close)[X]RETURN sma2005/15/2017 at 7:58 AM #3553305/15/2017 at 9:26 AM #35549Just in case it’s ok for you to include your shifted MA on your indicator without coding, it might be worth adding that you may also shift horizontally your MA by hand in the property window of the added MA (top right of the property window, in the box just below the period number), that’s what the function help was refering to without giving example.
05/15/2017 at 9:31 AM #3555205/15/2017 at 10:03 PM #3564805/16/2017 at 8:36 AM #35670 -
AuthorPosts
Find exclusive trading pro-tools on