Horizontally shifting a MA in an indicator
- This topic has 6 replies, 4 voices, and was last updated 7 years ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › Horizontally shifting a MA in an indicator
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.
If 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:
1 2 3 4 5 |
X = 10 //you'll get the value of the SMA from 10 bars ago sma20 = average[20](close)[X] RETURN sma20 |
Just 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.
Find exclusive trading pro-tools on