HULL MA
Forums › ProRealTime English forum › ProOrder support › HULL MA
- This topic has 6 replies, 4 voices, and was last updated 6 years ago by
nonetheless.
-
-
12/12/2019 at 7:49 PM #114770
Hi, I’ve been playing around with a simple trend-following code using TEMA but would prefer to have it work with the HULL MA, which is what I use for manual trading. I understand that v11 supports HullAverage[period](price) but I’m still working with v10.3 and it doesn’t recognise that syntax. How would I go about modifying the code below for Hull instead of Tema?
Hugely grateful for any help!
1234567891011121314151617181920212223242526272829303132333435363738394041// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsindicator1 = TEMA[21](typicalPrice)indicator2 = TEMA[21](typicalPrice)c1 = (indicator1 > indicator2[1])IF c1 AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsindicator3 = TEMA[21](typicalPrice)indicator4 = TEMA[21](typicalPrice)c2 = (indicator3 < indicator4[1])IF c2 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator5 = TEMA[21](typicalPrice)indicator6 = TEMA[21](typicalPrice)c3 = (indicator5 < indicator6[1])IF c3 AND not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Conditions to exit short positionsindicator7 = TEMA[21](typicalPrice)indicator8 = TEMA[21](typicalPrice)c4 = (indicator7 > indicator8[1])IF c4 THENEXITSHORT AT MARKETENDIF12/12/2019 at 8:09 PM #1147711indicator1 = Average[21,8](typicalPrice)Try above, I’ve had a few of my Systems use above successfully, but others say v10.3 doesn’t recognise Hull??
Let us know how you go on?
1 user thanked author for this post.
12/12/2019 at 9:14 PM #114777You can hard code the Hull average calculation into your strategy. Try this which has 21 period hull average based on typical price (not tested).
123456789101112131415161718192021222324252627282930313233343536// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0Period=21inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)hull = weightedaverage[round(sqrt(Period))](inner)// Conditions to enter long positionsc1 = hull > hull[1])c2 = hull < hull[1])IF c1 AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsIF c2 THENSELL AT MARKETENDIF// Conditions to enter short positionsIF c2 AND not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Conditions to exit short positionsIF c1 THENEXITSHORT AT MARKETENDIF1 user thanked author for this post.
12/12/2019 at 9:18 PM #114778If GraHal’s suggestion doesn’t work you can use the HULL indicator in the library https://www.prorealcode.com/prorealtime-indicators/hull-moving-average/.
12/12/2019 at 9:23 PM #114779Hey, thanks for that, I’ll try it as an option. What I was really looking for though is how to hardcode a definition of the Hull MA, which I believe is something like this. I just don’t know how to make it work!
123456Period=20inner = 2*weightedaverage[ round( Period/2 ) ](close)-weightedaverage[Period](close)MMHULL=weightedaverage[ round( sqrt(Period) ) ]( inner )return MMHULL12/12/2019 at 9:36 PM #114780Vonasi did show!
2 users thanked author for this post.
12/12/2019 at 10:16 PM #114782Vonasi, you are a megastar – thanks, exactly what I wanted!
Thanks too to all others, very much appreciated!
-
AuthorPosts
