Translating from Excel to PRC
Forums › ProRealTime English forum › ProBuilder support › Translating from Excel to PRC
- This topic has 7 replies, 4 voices, and was last updated 6 years ago by CharlieByrd.
-
-
07/30/2018 at 9:24 AM #77061
Hi!
Another trader shared an ATR (1) code to use as an intraday indicator that I really want to try out.
However since I am a beginner at coding and PRC is the first “language” I am learning, I need help translating this from Excel to PRC. I appreciate any help!
A1 = yesterdays close
A2 = day high
A3 = day low
=IF(A1<A3;A2-A1;IF(A1>A2;A1-A3;A2-A3))
07/30/2018 at 12:55 PM #77072I’m not big on Excel calculations but I think this is what it says. Apologies if I am wrong. If I am then I look forward to being corrected and to learn something!
123456789101112131415A1 = close[1]//yesterdays closeA2 = high//day highA3 = low//day lowIF A1 < A3 thena = A2 - A1elseif A1 > A2 thena = A1 - A3elsea = A2 - A3endifendifreturn a08/06/2018 at 10:04 PM #77667Did you get this to work? When i upload the code i get this result, if you have any tips please let me know!
Thanks in advance 🙂
08/06/2018 at 10:37 PM #7766908/07/2018 at 7:54 AM #77683That’s the formula of the true range, you could just use TR (keyword I discovered thanks to your question until then I thought the “average true range” over only 1 period was the only way to get it fast) and have the same result:
123x=TR(close)return xIf your next question was going to be how to program the average of this over say 14 periods for example, then you can use the averagetruerange keyword:
123x=AverageTrueRange[14](close)return x1 user thanked author for this post.
08/07/2018 at 8:31 AM #77684Yes – I guess I should read the question where it clearly says it is the ATR[1] calculation – but as usual I was more interested in the coding problem to solve than the actual question…. and I already knew about the TR instruction! Oh well it is all good practice.
This code confirms that all three return identical values – so the OP has three ways to choose from:
123456789101112131415161718c = averagetruerange[1]b = TRA1 = close[1]//yesterdays closeA2 = high//day highA3 = low//day lowIF A1 < A3 thena = A2 - A1elseif A1 > A2 thena = A1 - A3elsea = A2 - A3endifendifreturn a as "Calculation",b as "TR",c as "ATR"1 user thanked author for this post.
08/07/2018 at 9:53 AM #77694The trader who shared it with me uses it on an intraday futures chart to take trades. Not sure about the accuracy of it, that is really why I wanted to try it out.
The code shows the correct value when you add it as an indicator, but is there any way to place it on top of the price like in the example below?
12345A = Dhigh (0)B = Dlow (0)C = (A+B)/2RETURN A, B, C1 user thanked author for this post.
08/07/2018 at 10:01 AM #77698Hello Guys,
So i have talked to the author of the original code, he is a known swedish daytrader.
So this code is meant to be built in the chart(see the attachment).
Blue line = OMX30 Intraday
Grey line = ATR1 Daily (resolution) high & low
Yellow = (ATR1 daily high-low)/2+ATR1 daily low.
So when we spoke he mentioned that you must combine the daily chart ATR1 with intraday chart to make this possible.
I hope i have all the information needed for you guys to look further if it is possible to code this in PRT.
If you have questions i can contact the author because i would really love to see this work in PRT too!
-
AuthorPosts
Find exclusive trading pro-tools on