Distance in pips between two SMA
Forums › ProRealTime English forum › ProBuilder support › Distance in pips between two SMA
- This topic has 10 replies, 4 voices, and was last updated 3 years ago by cfg.
-
-
04/29/2021 at 9:59 PM #16841504/29/2021 at 10:50 PM #168417
Post your topic in the correct forum:
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves.I moved it from ProRealTime Platform Support.
Thank you 🙂
This will display both averages and the difference as an average of the difference from Sma300 (to be added ON the price chart):
1234Sma20 = average[20,0](close)Sma300 = average[300.0](close)Diff = Sma20 - Sma300Return Sma20 as "Sma20", Sma300 as "Sma300",(Sma300-Diff) as "Difference"This one will plot a line for the sole difference (to added BELOW the price chart):
1234Sma20 = average[20,0](close)Sma300 = average[300.0](close)Diff = Sma20 - Sma300Return Diff as "Difference"1 user thanked author for this post.
05/03/2021 at 4:19 PM #168692Hi Robertogozzi, thank you for your message.
Apologies for posting in the wrong section.
Both indicators are working correctly, but I cannot understand the “difference”. The difference in pips between 119.868 and 119.739 cannot be 119.97, but 0.129. How can I display the difference in pips between the two simple moving averages? i.e +32 when sma20 superior to sma300 or -32 when sma20 is below sma300.
Thanks in advance.
cfg
05/03/2021 at 4:57 PM #168703Use the second one, you will have to put it UNDER the price (not ON it), like Macd, etc…, because they are not on the same scale.
The first one cannot work, actually.
05/03/2021 at 4:59 PM #168704In both indicators 300.0 must be replaced with:
1300,005/04/2021 at 1:27 PM #168774It can also like this:
123456789101112131415161718//Zigo//4/05/2021MA300=Average[300](close)MA20=Average[20](close)diff=round(MA300-MA20)a= ((MA300+MA20)/2)if diff -diff[1] <0 thenr=0g=155bl=155elsif diff-diff[1]>0 thenr=255g=0bl=0endifDRAWTEXT(" #diff#", barindex, a, dialog, standard, 12)coloured(r,g,bl,255)return1 user thanked author for this post.
05/10/2021 at 9:45 AM #16923905/10/2021 at 10:42 AM #169251Because the rounding isn’t using decimals, try with a value transformed in points:
123456789101112131415161718//Zigo//4/05/2021MA300=Average[300](close)MA20=Average[20](close)diff=round((MA300-MA20)/pointsize)a= ((MA300+MA20)/2)if diff -diff[1] <0 thenr=0g=155bl=155elsif diff-diff[1]>0 thenr=255g=0bl=0endifDRAWTEXT(" #diff#", barindex, a, dialog, standard, 12)coloured(r,g,bl,255)return1 user thanked author for this post.
05/10/2021 at 11:39 AM #16925805/10/2021 at 12:19 PM #16926905/10/2021 at 1:16 PM #169279 -
AuthorPosts
Find exclusive trading pro-tools on