On screen calculator
- This topic has 5 replies, 3 voices, and was last updated 5 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › On screen calculator
Hi,
Something like that, with a pixel position from top right corner (hence the negative Xpixel and Ypixel values, customisable as long as they remain negative to indicate going leftward and downward from top right corner).With another use of drawtext, it would also be possible to just keep display on a given barindex rather than a pixel position if preferred.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
defparam drawonlastbaronly=true // Choose pixel fixed position from top right corner with negative X and Y values Xpixel= -100 Ypixel= -50 ma20= Average[20](close) ma50= Average[50](close) diff= ma20-ma50 DRAWTEXT("MA20-MA50= #diff#", Xpixel, Ypixel) anchor(topright, Xshift, Yshift) return |
Hi,
The current calculation is the absolute difference between the two averages:
AbsDiff = (MA20 – MA50)
If you want to calculate the relative difference in percentages:
RelDiff = (MA20 – MA50) / MA50 * 100
Or alternatively written as:
RelDiff = (MA20 / MA50 – 1) * 100
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
defparam drawonlastbaronly=true // Choose pixel fixed position from top right corner with negative X and Y values Xpixel= -100 Ypixel= -50 ma20= Average[20](close) ma50= Average[50](close) diff= ma20-ma50 DiffPct=(ma20-ma50)/ma50*100 DRAWTEXT("Abs. Difference=#diff#", Xpixel, Ypixel) anchor(topright, Xshift, Yshift) DRAWTEXT("Relat. Difference=#diffpct#%", Xpixel, Ypixel-20) anchor(topright, Xshift, Yshift) return ma20 as "Fast" coloured("red"), ma50 as "Slow" coloured("green") |
Find exclusive trading pro-tools on 